asp.net-mvc-5web-configmime-typesstatic-content

Static Content error debbug in localhost with VisualStudio


I have added some mime that I needed for my project in MVC5 because in production it did not work.

<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>

Once added I have published and the app works correctly.

When trying to debug the app in local with VisualStudio, it doesn't find any mime. enter image description here

If I comment the code of the Web.config it works correctly in local but not in production.

How can I not be commenting and uncommenting this code?


Solution

  • I have made the following implementation and I have managed to make everything work correctly both in the production version and in the local version

    <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>
    

    I could find the solution here reference