Images not loading through CSS on IIS7.5 MVC4

本小妞迷上赌 提交于 2019-12-11 11:57:31

问题


My web app(MVC4) is hosted on IIS 7.5, Windows 7 Ultimate with .net framework 4.0 and 4.5 installed. On hosting the application, the images are not rendered, giving me a 404 error

The content type is "Text/html" shouldn't it show as "image/jpeg or png"?

On giving the image path directly, the image is rendered, but not through css. The css is loading, as my layout is intact.

I have gone through many questions related to the same issue, have included

<modules runAllManagedModulesForAllRequests="true" />

checked for Static Content under IIS>WWW Services in control Panel, applied hotfixes (http://support.microsoft.com/kb/980368).. in vain.

My css code is as below,

body{background:url(images/bg.jpg);

image folder structure is

  • ABC
    • images (folder)
      • bg.jpg
    • main.css

(have tried giving the image path along with .. and /, no use)

ExtensionlessUrlHandler, are present in the webconfig, hosted on .net framework 4.0 (integrated),

My IIS also co-hosts MVC3 application, which runs fine.

Not sure what is the issue? I am missing something, which hasn't been tried yet, your help would give me some sleep.

Update:

Refering to this post

I changed the bundle according to the answer by Calgary Coder, the image is loading now.


回答1:


As per this post,

I changed my bundle (as per below format/pattern)

bundles.Add(new StyleBundle("~/Content/css/jquery-ui/bundle")
       .Include("~/Content/css/jquery-ui/*.css"));

And the images are loading now. Thanks to Calgary Coder.



来源:https://stackoverflow.com/questions/16815667/images-not-loading-through-css-on-iis7-5-mvc4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!