使用VisualStudio在localhost中进行静态内容错误调试

问题描述

我添加了一些我在MVC5中的项目所需的哑剧,因为在生产中它不起作用。

<system.webServer>
 <staticContent>      
        <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" /> 
        <mimeMap fileExtension=".woff2" mimeType="application/x-font-woff2" /> 
        <mimeMap fileExtension=".js.min" mimeType="text/javascript" /> 
 </staticContent>
</system.webServer>

添加后,我已经发布并且该应用可以正常运行。

当尝试使用VisualStudio在本地调试应用程序时,找不到任何哑剧。

enter image description here

如果我注释Web.config的代码,则它可以在本地正常运行,但不能在生产环境中正常工作。

我怎么不注释和取消注释此代码?

解决方法

我已经实现了以下实现,并且设法使所有版本在生产版本和本地版本中都能正常工作

<system.webServer>
 <staticContent>    
    <remove fileExtension=".woff" />  
    <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" /> 
    <remove fileExtension=".woff2" />
    <mimeMap fileExtension=".woff2" mimeType="application/x-font-woff2" /> 
    <remove fileExtension=".js.min" />
    <mimeMap fileExtension=".js.min" mimeType="text/javascript" /> 
 </staticContent>
</system.webServer>

我可以在这里reference

找到解决方案

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...