IIS 7 Windows Server 2008 / CSS文件未在aspx中加载 [英] IIS 7 Windows Server 2008 / CSS file not loading within aspx

查看:261
本文介绍了IIS 7 Windows Server 2008 / CSS文件未在aspx中加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现了与此问题相关的几个主题但我找不到适用于我的问题的答案,其中包括:
我将我的Asp.Net 4.0站点移动到新服务器(IIS 7,Windows Server 2008)。服务器端工作正常但CSS样式表未加载。
当我使用firebug时,我在应该加载css的部分看到以下内容

I've found out several topics related to this issue yet I couldn't find an answer which worked for my problem, which is following: I moved my Asp.Net 4.0 site to a new server (IIS 7, Windows Server 2008). The server side is working fine but the CSS style sheet is not loading. When I use firebug, I see the following on the part where css should be loaded

尽管如此这条消息,我可以在网上显示css(在文本中)的内容(例如../Styles/button.css ..etc)

Despite this message,I can display the content of the css (in text) on the web (such as ../Styles/button.css ..etc)

我有尝试了一些解决方案,例如IIS上的staticFile处理程序映射或在服务器管理器上添加ASP角色(通过控制面板)。

I have tried some solutions such as staticFile handler mapping on IIS or adding ASP roles on server manager (through control panel).

任何帮助都将被赞赏
亲切的问候

Any help would be appreciated Kind regards

推荐答案

您发现的文章/主题与Uali的答案相同,这是正确的,但它并没有总能解决每个人的问题。问题也与你的css本身无关。

The articles/topics that you have found is talking about the same thing as Uali's answer, which is correct, but it doesn't always solve everyone's problem. The problem is also not about your css per se.

在继续之前,请确保已按照指示的其他答案启用静态内容

Before proceeding, make sure that you have enabled Static Content as the other answer instructed.

然后在 IIS管理器窗口中执行以下步骤,并选择虚拟目录。

Then do these steps in the IIS Manager window with your virtual directory selected.


  1. 打开处理程序映射

  2. 点击右侧动作面板中的添加托管处理程序

  3. 在请求路径字段中,键入: *。css

  4. 在类型文本框中,输入: System.Web.StaticFileHandler

  5. 在名称文本框中,键入所需的任何描述性名称,例如 css fix

  6. 点击确定。

  1. Open Handler Mappings.
  2. Click Add Managed Handler in the Actions Panel located in the right.
  3. In the request path field, type: *.css
  4. In the type textbox, enter: System.Web.StaticFileHandler
  5. In the name textbox, type in any descriptive name you want such as css fix.
  6. Click OK.

更新:
我也忘了说你可以做同样的事情适用于.jpg,.png,.gif或任何其他文件类型。

Update: I also forgot to say that you can do the same thing for .jpg, .png, .gif or any other file types if necessary.

这篇关于IIS 7 Windows Server 2008 / CSS文件未在aspx中加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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