nopCommerce 5.0 Installation CSS errors

4 days ago
Hello,

When I install nopCommerce 5.0 x86 on Windows, I run into stylesheet errors.  These are the errors I see in a browser's Dev console:

Refused to apply style from 'http://iis8rayh.com/nopCommerce/css/1b2m2y8asgtpgamy7phcfg.styles.css' because its MIME type ('') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
Refused to apply style from 'http://iis8rayh.com/nopCommerce/css/1b2m2y8asgtpgamy7phcfg.styles.css' because its MIME type ('') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
Refused to execute script from 'http://iis8rayh.com/nopCommerce/js/1b2m2y8asgtpgamy7phcfg.scripts.js' because its MIME type ('') is not executable, and strict MIME type checking is enabled.

Does anyone know how to correct this?
3 days ago
The file name gives this one away: 1b2m2y8asgtpgamy7phcfg is the MD5 hash of an empty string. In 5.0 the bundle name comes from NopHtmlHelper.GetAssetKey, which hashes the comma-joined list of local CSS/JS paths. So your bundles were built from empty paths. The /css/... and /js/... URLs are virtual routes served by WebOptimizer, and there's nothing to serve, which is why the response has no content type and the browser rejects it.

The likely cause is running under a virtual application (/nopCommerce). The asset paths have the application path stripped (GetSrcUrl in NopHtmlHelper.cs) before they're hashed, and that seems to go wrong in your setup.

Two ways to get going:

1. Turn bundling off in App_Data/appsettings.json and restart the app pool. With both flags false, nopCommerce skips WebOptimizer and links the individual files:
"WebOptimizer": {
  "EnableJavaScriptBundling": false,
  "EnableCssBundling": false,
  ...
}

2. Or run nopCommerce as its own IIS site on a host name instead of under /nopCommerce. That's the setup with the fewest path problems.

If it still breaks with bundling off, post the status code the browser gets for one of the individual .css files.
3 days ago
Thank you for the explanation.  I installed it in the root to avoid the path problems.  I tried turning off bundling, but the same errors persisted, and I get status codes of 404.
2 days ago
We confirm the issue with virtual directories in 5.00. Here is a work item
2 days ago
Hi!
We found the issue and fixed it; you can see the details in this commit.