1

When I debug my site the CSS does not show. I get an Error 500 on the Site.css when I inspect it in Firefox.

My _Layout.cshtml is set to use the css files.

@Styles.Render("~/Content/css")

I did verify the Site.css file is in the correct folder and I can open it directly using Notepad.

I have looked at BundleConfig.cs and I see where it's bundled with the other files.

bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));
bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
                    "~/Content/themes/base/jquery.ui.core.css",
                    "~/Content/themes/base/jquery.ui.resizable.css",
                    "~/Content/themes/base/jquery.ui.selectable.css",
                    "~/Content/themes/base/jquery.ui.accordion.css",
                    "~/Content/themes/base/jquery.ui.autocomplete.css",
                    "~/Content/themes/base/jquery.ui.button.css",
                    "~/Content/themes/base/jquery.ui.dialog.css",
                    "~/Content/themes/base/jquery.ui.slider.css",
                    "~/Content/themes/base/jquery.ui.tabs.css",
                    "~/Content/themes/base/jquery.ui.datepicker.css",
                    "~/Content/themes/base/jquery.ui.progressbar.css",
                    "~/Content/themes/base/jquery.ui.theme.css"));
    }

the really odd part is I do have this setup on IIS7.5 and the css works, but the background image does not. We are getting error 500 on it also. The IIS_Users does have the rights to access those files.

The last problem is that any images are not showing on the site. On the css the background is set like

background: url("../Images/heroAccent.png") no-repeat;

The Images directory is under the same directory as Views/Models/Controllers etc.

1
  • Add the description of the error 500 Commented May 4, 2017 at 17:49

1 Answer 1

1

These errors raise for mvc bundling features in css having image path absolute. here are two ways resolved the error

  1. off bundling (using EnableOptimization=false)
  2. Correct image path with doing root path relative
Sign up to request clarification or add additional context in comments.

1 Comment

I should have said I am a beginner at this lol. I have removed the ~ and the css works now. BUT the image that I use as the background image is still not showing. This is the error I am getting GET localhost:54898/Images/CircuitSearchBackgroundTrans.png [HTTP/1.1 500 Internal Server Error 18ms]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.