IIS Express中添加MIME

1,打开命令行cmd

>cd C:\"Program Files"\"IIS Express"

>appcmd set config /section:staticContent /+[fileExtension='.mjs',mimeType='text/javascript']

会提示:

已经在配置提交路径“MACHINE/WEBROOT/APPHOST”向“MACHINE/WEBROOT/APPHOST”的“system.webServer/staticContent”节应用了配置更改

 打开C:\Users\admin(当前用户名)\Documents\IISExpress\config\applicationhost.config

会发现这一行:<mimeMap fileExtension=".mjs" mimeType="text/javascript" />

 

2,修改web.config(只会影响当前web)

<system.webServer>
<staticContent>
<mimeMap fileExtension=".mjs" mimeType="text/javascript"/>
</staticContent>
</system.webServer>

posted @ 2022-01-13 15:29  悠哉大斌  阅读(458)  评论(0)    收藏  举报