Error when fetching .css files in Azure
我在Azure上有一个nodejs应用程序(作为Web应用程序安装),尝试获取样式表(.css)时收到以下消息:
1 | Resource interpreted as Stylesheet but transferred with MIME type text/html |
我已阅读到问题是IIS配置,所以我的问题是:
根据我的经验,我认为这不是IIS问题。
看来您是在以自己的方式提供静态文件。
在Azure Web Apps中,我们不需要这样做,
如果查看
因此,我们只需在项目的根目录下添加一个名为
1 2 3 4 | <!-- First we consider whether the incoming URL matches a physical file in the /public folder --> <rule name="StaticContent"> </rule> |
例如,项目结构如下所示,
如果您使用的是Express,还可以使用下面的代码做同样的事情,
1 | app.use(express.static('public')) |