为什么这个 CSS 加载了 MIME 类型 "text/troff"?

Why is this CSS loaded with MIME type "text/troff"?

我通过

将我的CSS文件添加到我的HTML文件的header中
<link href="project.css" type="text/css" rel="stylesheet" />

在 FF 上以检查模式打开页面时,我可以在控制台中看到

The stylesheet https://example.com/project.css was not loaded because its MIME type, "text/troff", is not "text/css".

文件本身非常标准(顶部注释的存在与否不会改变任何东西 - 我试图暗示这是一个 CSS 文件)

/*!
CSS for project
*/

#devices {
    display: table;
    width: 100%;
    table-layout: fixed;
}
.row {
    display: table-row;
    vertical-align: middle;
}

(...)

在同一个 header 中,Bootstrap 被正确加载:

 <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" type="text/css" />

我应该做些什么才能正确识别 MIME 类型?

I was under the impression that type="text/css" would be enough to tell the browser the MIME type.

它确实告诉浏览器它期望链接资源是什么 MIME 类型,这就是错误显示 "its MIME type [...] is not 'text/css'." 的原因,但它不保证服务器实际上会提供该资源MIME 类型。这取决于服务器。

由于安全问题,将样式 sheet "rel" 标签类型 属性 设置为 text/css 是不够的,您应该在 http [=] 中设置内容类型17=](content-type:text/css),这个问题是老问题,但如果其他人在 IIS 中遇到此问题并看到此页面:转到控制面板 -> 程序和功能 -> 转 windows 功能开启或关闭 -> Internet 信息服务 -> 万维网服务 -> 通用 http 功能 -> 静态内容,启用此选项并重新启动您的 IIS。