Jan 25, 2016

Azure web app won't download my file because of the mimetype

If you have a non-standard file without a common mimetype (eg. dwg files for AutoCAD), Azure Web App sites won't serve them and instead give a 404 error.

This is a policy decision dating back to IIS 6.0.

The fix is simply adding the unknown mimetype to the web.config for the Azure Web App: https://www.iis.net/configreference/system.webserver/staticcontent/mimemap

For example:

<configuration>
   <system.webServer>
      <staticContent>
         <mimeMap fileExtension=".dwg" mimeType="application/acad" />
      </staticContent>
   </system.webServer>
</configuration>
 

No comments:

Post a Comment