0
votes

CSS was loaded to web when using visual studio IIS express. when i deploy to my local IIS, the css was not render fully. IIS static was on.

Another thing i noticed was that if i point my web path in IIS to my development folder. it works fine also.

i use visual studio build in public with file system to public the web.

Correct CSS header enter image description here

Problem CSS header enter image description here

Updated public static void RegisterBundles(BundleCollection bundles) { BundleTable.EnableOptimizations = true;

1
Are you using bundling? If so, when debugging (and using IIS Express) have you set BundleTable.EnableOptimizations? This appears to be normal behaviour between debug and release when using bundling. - Richard
yes i am using bundling.do i add that to first line to bundle? - MVC newbie
added code BundleTable.EnableOptimizations = true; to my registerbundle. still the same - MVC newbie
Go through your bundle definition code (often in App_Start\BundleConfig.cs) and check you're including all the correct CSS files in the correct order there. If done right bundling will make no difference to the effect of styles but be quicker and use fewer resources. - Richard
hi. i tried setting budinletable.enableoptimizations=false and it works. Thanks for helping me pointing the direction. - MVC newbie

1 Answers

0
votes

It appears you are using ASP.NET-MVC with its standard CSS/JS bundling support.

By setting BundleTable.EnableOptimizations or not depending on build configuration you can switch from debug (no minification and bundling: good for debugging) to release (minimise number of files by bundling and size by minifying).

It looks like things are working correctly.

If you are seeing different behaviour then it is likely you need to fix your bundle configurations (ordering is significant).

The easiest route is to always use bundling for all CSS and JS served from your server, and use the above switch to disable when debugging.