且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

资源被解释为样式表,但在 ASP.NET IIS 中使用 MIME 类型 text/html 传输

更新时间:2021-08-23 21:28:36

在我看来,问题出在您的 IIS 配置中.它可能被配置为传送具有 text/html MIME 类型的 .css 文件.

Seems to me like the problem is in your IIS configuration. it might be configured to deliver .css files with text/html MIME type.

尝试转到 Web 服务器上的 MIME 类型配置,看看是否可以在其中发现任何内容.

Try going to the MIME types configuration on the web server and see if you can spot anything there.

.css 文件的正确 MIME 类型是 text/css.

The correct MIME type for .css files is text/css.

您还可以使用一些 HTTP 嗅探器(例如 fiddler)查看 HTTP 标头参数.

You can also have a look on the HTTP header parameters with some HTTP sniffer such as fiddler.

更新:接受的答案应该是@brett-pennings 指出的答案!只提供静态内容,错误自动消失.

Updating: The accepted answer should be the one pointed by @brett-pennings! Just providing static contents, the error vanished automatically.