图像无法通过IIS7.5 MVC4上的CSS加载 [英] Images not loading through CSS on IIS7.5 MVC4

查看:244
本文介绍了图像无法通过IIS7.5 MVC4上的CSS加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网络应用程序(MVC4)托管在IIS 7.5,Windows 7 Ultimate上,安装了.net framework 4.0和4.5。在托管应用程序时,图像不会呈现,给我404错误

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

内容类型为Text / html不应显示为image / jpeg或png?

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

在直接给出图像路径时,图像被渲染,但不是通过css。 css正在加载,因为我的布局完好无损。

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" />

检查IIS下的静态内容>
控制面板中的WWW服务,应用的修补程序(< a href =http://support.microsoft.com/kb/980368 =nofollow noreferrer> http://support.microsoft.com/kb/980368 )..徒劳。

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

我的css代码如下,

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

图片文件夹结构


  • ABC


    • images(文件夹)


      • bg.jpg

      (已尝试提供图片路径以及..和/,没用)

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

      ExtensionlessUrlHandler,存在于webconfig中,托管在.net framework 4.0(集成)上,

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

      我的IIS还共同托管MVC3应用程序,运行正常。

      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.

      更新:

      参考此发布

      我根据Calgary Coder的回答更改了捆绑包,图片正在加载。

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

      推荐答案

      根据发布

      我更改了我的包(按照以下格式/模式)

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

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

      图片正在加载。感谢Calgary Coder。

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

      这篇关于图像无法通过IIS7.5 MVC4上的CSS加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆