I was working on deployment of Angular2 application with ASP.NET MVC 5 on Azure and came across this specific issue that all images of extension .woff and .woff2 were not loading successfully in browser, although path of these files were correct, Everything was working fine in local machine but after deployment on Azure it stop loading all sprites and images with mime of extension .woff, .woff2.
My project web.config has below code:
<staticContent> <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" /> <mimeMap fileExtension=".woff2" mimeType="application/x-font-woff" /> </staticContent>
I checked all below scenario and there was no issue:
- Check permissions in IIS and on disk for files
- Check IIS setting for static files
Where as I needed below code because newer version of IIS on Server 2012 has .woff and .woff2 already added in its MIME list, if we try to add same MIME again then it crash without giving any proper stack trace error and just went 500. So I remove faulty file extension and introduce proper MIME configuration in web.config all over again..
<staticContent> <remove fileExtension=".woff" /> <remove fileExtension=".woff2" /> <mimeMap fileExtension=".woff" mimeType="application/font-woff" /> <mimeMap fileExtension=".woff2" mimeType="application/font-woff2" /> </staticContent>