Problem with bundleCss/Js in #Script



  • dotnet core 2.2
  • ss 5.6.0
  • ubuntu

Mapped virtual files source on folder with 1.500.000+ images

AddVirtualFileSources.Add(new FileSystemMapping(imagesWebRootPath, imagesOsRootPath));



{{ (debug ? '' : '[hash].min') | assignTo: min }}

{{ [ '!/assets/css/default.css', '/assets/css/' ] | bundleCss({ disk:!debug, out:`/css/lib.bundle${min}.css` }) }}
{{ [ '/assets/css/default.css'] | bundleCss({ minify:!debug, cache:!debug, disk:!debug, out:`/css/bundle${min}.css` }) }}


{{ [ '!/assets/js/default.js', '/assets/js/' ] | bundleJs({ disk:!debug, out:`/js/lib.bundle${min}.js` }) }}
{{ [ '/assets/js/default.js' ] | bundleJs({ minify:!debug, cache:!debug, disk:!debug, out:`/js/bundle${min}.js` }) }}

Im having a following problem:

  • on application starting cpu is 100% for long time (more than 60 secs)
  • I’m getting “Application started” in console but website is not available as log as cpu is high
  • once “scanning” is finished I can access website
  • this happens only when bundle files not exists, if files exists everything works as it should

When I turn off bundling of css and js, app is starting in few seconds.
While starting app it appears that bundleCss/Js is scaning virtual files source folder also, which is not stated in bundle configuration.

Kind regards

The scan may be coming from usage of wildcard directories, e.g. /assets/css/ and /assets/js/ in which case you can try specifying the files individually to avoid the scan.

Alternatively you can specify which VFS provider you want to use, e.g: filesystem:/assets/css/ will only search for the VFS FileSystem Provider from the WebRoot VirtualFilesSources. Alternatively you can use content:/wwwroot/assets/css/ to search usign the ContentRoot VirtualFiles provider.

Thank you for quick answer.
I have tried following, all without success:

  • specified each file individually for bundle*
  • tried to specify VFS provider for wildcard directory, both content and filesystem

To be a bit more specific about environment:

  • ubuntu linux server, on boot remote share is being mapped on local folder imagesOsRootPath
  • mapped folder have /year-month/year-month-day/ structure with 1.5+ million of files distributed trough last level folders
  • in AppHost Configure I am adding VFS as in first post
  • on app start I can see that dotnet process is starting to use cpu in high percentage
  • in matter of seconds process called cifsd (cifs mapped network share) is also starting to hog on cpu
  • while both processes are active (high cpu %), website does not response on requests
  • after some time (in my case about almost minute) a css folder is being created
  • after about same time needed for css, js folder is being created
  • cpu goes down (both dotnet and cifsd processess), website becomes available
  • this happens only when css and js folders do not exists, on next start app starts normally
  • app is also starting normally when not using bundle* (when each css and js file is stated regularly in html)

If you need any additional information that I may have overlooked please ask.


I think it’s because you’re using a [hash], the bundle doesn’t know what the previous hash was so it does a wildcard search for matching files:

Can you confirm that it doesn’t do the file scan when not using a [hash] placeholder? e.g:

{{ (debug ? '' : '.min') | assignTo: min }}

I can confirm that app is starting normally when not using [hash].

This leaves two questions open:

  1. If not using hash, how to invalidate browser cached css and js bundles (after app update or similar)?
  2. Is there a way to force bundle* to scan only wildcard directories specified in config, regardles of [hash] usage?


I’ll look into limiting the wildcard search, should be able to just manually inspect the files of that directory instead of doing a file search.

One way to avoid using the [hash] and still have a cache-breaker is to add a version number in the bundle name, e.g:

{{ 'v2' | to => version }}

{{ [ '!/assets/css/default.css', '/assets/css/' ] 
   | bundleCss({ disk:!debug, out:`/css/lib.bundle.${version}.${min}.css` }) }}
1 Like

ServiceStack now uses a manual glob search from this commit to avoid the file scan.

This change is available from v5.6.1 that’s now available on MyGet.

Everything works as expected. Thank you for such a quick response and fix.

1 Like