Azure and .json mimeType without web.config Azure and .json mimeType without web.config azure azure

Azure and .json mimeType without web.config


This should work:

<system.webServer>  <staticContent>    <remove fileExtension=".json" />    <mimeMap fileExtension=".json" mimeType="application/json" />  </staticContent></system.webServer>

See also here: http://blogs.msdn.com/b/chaun/archive/2009/12/04/iis7-error-cannot-add-duplicate-collection-entry-of-type-mimemap-with-unique-key-attribute-fileextension.aspx

This doesn't make any difference to your overall IIS configuration, it just conditionally removes the mimeMap from the configuration of this particular site (as governed by this web.config) before adding it again.


You can create a startup task that adds the mime type on IIS level. This way you won't need to include it in your web.config:

"%windir%\System32\inetsrv\appcmd.exe" set config /section:staticContent /+"[fileExtension='.json',mimeType='application/json']"exit /b 0