0

I have a few sites running with ASP.Net 4.5 and Bootstrap 3.3.7, no problems.

Currently working on a site looks fine in development. Went to publish to a Test Server and something has gone wrong.

Has anyone run into this before and where can I look to try and fix. I have been looking at this for 4 hours now and I am getting ready to loose it.

Working Fine

Not Working

More digging. From the Network Tab I am getting a 404 on Content/css which is produced from:

<webopt:bundlereference runat="server" path="~/Content/css" />

That folder does contain bootstrap.css.

rezlab
  • 43
  • 1
  • 7
  • Looks like styles are not being loaded. Need to make sure stylesheet file is in correct location. Open inspection tool in your internet browser. Can you see any error in console. Go to Network tab and see what's missing. – derloopkat Oct 17 '17 at 15:01
  • 1
    What version of IE are you using in the second photo? – MisterMystery Oct 17 '17 at 15:02
  • Both are IE 11. – rezlab Oct 17 '17 at 15:05
  • Please supply some code. How do you reference the stylesheet? – SteinTheRuler Oct 17 '17 at 15:06
  • Adding on to @derloopkat's comment, the "Not Working" pic suggests that your problem is with styles generally, rather than Bootstrap specifically. I'd also look to see if the same issue occurs across different browsers. – Kevin Fichter Oct 17 '17 at 15:06
  • Are you using MVC or plain old ASP.NET? One possible cause is that IE has a tendency to load the element differently than other browsers. If you are using this, check the page source and make sure that is directly after MVC's base layout page tends to move the tag after javascript and css imports. It's an easy fix. – peewee_RotA Oct 17 '17 at 15:08
  • Without more information, here are some common trouble shooting steps. --1) Check what mode your IIS server is in. If it is being shared with a legacy .NET application or the pools are set up with the wrong .NET version it can be super wonky. --2) In MVC the bundler is almost always the culprit... Make sure the relative paths of your style sheets match the bundles that are being served in the paths you expect. Most cshtml files will have "../../../" as relative paths. if these do not match the structure of the bundler's output they can be pointing at the wrong location. – peewee_RotA Oct 17 '17 at 15:14
  • (continued part 2/2) ...This is because MVC's bundler serves the original files in debug mode and the actual bundle in release/deployment mode --3) Make sure you are not bundling minified js. If you are relying on any components with JS counterparts, the MVC bundler likes to nuke minified files. Make it point to only .js files (as opposed to .min.js). The bundler can use the all (*)wildcard but nothing more specific. So if there are .min.js files next to .js, you will have to either remove the .min.js files or create literal references to every single JS file in your bundler – peewee_RotA Oct 17 '17 at 15:20
  • IIS is integrated .net .4. – rezlab Oct 17 '17 at 15:20
  • Based on what I can find about that webopt:bundlerreference control, it works similar to MVC. First you define the bundle and assign it to a folder (in this case "~/Content/css") and then you render the bundle using something like that bundlereference control or a Styles.Render tag. Lastly, the folder path defined in the bundle has to match any internal relatives paths in the CSS files themselves. This answer should point to the relevant code sections so you can better debug this: https://stackoverflow.com/questions/22863705/weboptbundlereference-renders-scriptbundle-as-css-link-elements – peewee_RotA Oct 17 '17 at 15:37

1 Answers1

2

Much thanks to all who responded. I am truly appreciative.

Special thanks to peewee_RotA who clued me in enough that led me to just rip out the <webopt:bundlereference runat="server" path="~/Content/css" /> and just replace with actual references like <link href="Content/bootstrap.css" rel="stylesheet" type="text/css" />.

Do not know why the bundler did not work, do not care.

rezlab
  • 43
  • 1
  • 7
  • These are super frustrating problems. I'm glad you got to a solution and I wish you luck. That being said, I hope you have a chance to revisit this and find out what is wrong with the bundler. I don't think this will make a good long term fix. Either way, I feel your pain. Been cut a thousand cuts by this problem many times in the past. Cheers! – peewee_RotA Oct 17 '17 at 15:47