1

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

enter image description here

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.

Community
  • 1
  • 1
RNH
  • 93
  • 1
  • 8
  • On giving the image path directly, the image is rendered, it means path is correct and also you have given full absolute path to render.In css, you have given relative path "/images/bg.jpg", please check if level of folder access is same i.e. css file has valid relative path in respect to level of directories. – Pranav Singh May 29 '13 at 13:52
  • Not sure on what you mean my folder access, you mean permission to the image folder? it is same as that of the parent, all the folder under this app are having the same access right. – RNH May 29 '13 at 14:06
  • Error is HTTP 404 i.e. not found. I mean by folder access, please check if css is located in some different folder than images then relative path to image is accesible to css or not. – Pranav Singh May 29 '13 at 14:14
  • The css and image-folder are present in the same folder, Content > ABC > images (folder) and all css – RNH May 29 '13 at 14:16

1 Answers1

0

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.

Community
  • 1
  • 1
RNH
  • 93
  • 1
  • 8