0

Strangest problem. I have an ASP.NET website (webforms) that works fine on VS2015, but all of the sudden, once I upload the files to IIS8 and try to view the site in the browser, none of the bundled CSS style sheets will load. Directly typing in the style sheet into the browser loads it fine. All javascript bundles also load and all pages and all references EXCEPT CSS. I've been fighting this for a day now and this is baffling (it WAS working on IIS8 - so it's not a config problem there - other sites have no problems either). It's not a security problem, either - IUSR has full access to the Content folder. Nothing on IIS was changed before this happened (except some windows server updates - could there be a bug?). I tried putting in a web.config file into the ~/Content folder to grant full access. No luck there. I've cleared the cache in FF,Chrome and IE thinking there was a cache issue - no luck. I've looked at the download (from the web developer console on FireFox) and all the files are downloading EXCEPT CSS!?!? My guess is that the CSS "bundling" feature is somehow not working (though the file hasn't been changed and was working fine on IIS).

  <?xml version="1.0" encoding="utf-8" ?>
    <bundles version="1.0">
      <styleBundle path="~/Content/css">
       <include path="~/Content/bootstrap.min.css" />
        <include path="~/Content/bootstrap-theme.min.css"/>
        <include path="~/Scripts/FooTable-2/css/footable.core.min.css" />
        <include path="~/Scripts/FooTable-2/css/footable.custom.css" />
        <include path="~/Scripts/gentleSelect/GS.css" />
        <include path="~/Content/Site.css" />
        <include path="~/Content/css/select2.min.css" />
        <include path="~/Content/select2-bootstrap.css" />  
      </styleBundle>
    </bundles>

The other suspect is that I updated bootstrap from Nuget (a minor version update) and, perhaps this corrupted the bundling. Not sure what happened, but it could take days of trial and error to determine this. Hoping someone else has had this problem (and a solution).

MC9000
  • 2,076
  • 7
  • 45
  • 80
  • Okay, so far I've completely ruled out IIS or any settings there. I put the old version of the website (which bundling was working fine) back up and it works. I've ruled out the web.config file as well - they are identical except the upgrade to json (from ver 7 to ver 8). More guesswork to follow. – MC9000 Apr 19 '16 at 04:09
  • At Wit's end here. Gave "god-mode" permissions to IUSR account, made sure it was associated with the Application Pool - no joy. Restored the old version of the site only to discover the CSS no longer works on it now (it worked before). I've also checked the Request Filtering, Mime types, output Caching is disabled. Verified the Static Content was enabled on IIS. I think this must be a bug in IIS8 (running Windows Server 2012) and one of the last updates fried the settings somewhere (but where, is anyone's guess). – MC9000 Apr 19 '16 at 21:06

1 Answers1

0

I figured out what was wrong. There was a folder called "css" in the "Content" folder. I moved the css files out of that folder and deleted it (that is, I deleted the css folder). So the bundle config looks like so:

<?xml version="1.0" encoding="utf-8" ?>
<bundles version="1.0">
  <styleBundle path="~/Content/css">
   <include path="~/Content/bootstrap.min.css" />
    <include path="~/Content/bootstrap-theme.min.css"/>
    <include path="~/Scripts/FooTable-2/css/footable.core.min.css" />
    <include path="~/Scripts/FooTable-2/css/footable.custom.css" />
    <include path="~/Scripts/gentleSelect/GS.css" />
    <include path="~/Content/Site.css" />
    <include path="~/Content/select2.min.css" />
    <include path="~/Content/select2-bootstrap.css" />  
  </styleBundle>
</bundles>

IIS gets confused if the styleBundle "path" actually has a folder with the same name - the last part of this "path" should not actually exist in the file structure. ASP.NET MVC framework 4.5 CSS bundles does not work on the hosting

Community
  • 1
  • 1
MC9000
  • 2,076
  • 7
  • 45
  • 80