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>

原文地址:https://www.cnblogs.com/imust2008/p/15797852.html