Search code examples
azureiis-7.5windows-server-2008-r2

Windows Azure osFamily 2 throw error 500 for static files


We are facing a similar problem to this case with the deployment of our web role cloud service to osFamily 2 (Windows 2008 R2) in Windows Azure. The difference is ours is a straight ASP.NET MVC web role and not a custom virtual machine.

The deployment on osFamily 1 (Windows 2008/IIS 7.0) works perfectly fine and we can request for static contents. (E.g. /favicon.ico /404.html) But when deployed to osFamily 2 it simply breaks with error 500 without much explanation. The static file module and handler mappings are all already in place in those virtual servers. Tried a reboot like the previous person did but to no avail for our case.

The same web app works as expected on our Windows 7/IIS 7.5 workstation.

Is there something we're forgetting about these provisioned servers in Windows Azure (that osFamily 1 has no problem with)?


Solution

  • Ok interesting, there is no problem on a regular Windows Server 2008 R2; works as expected. The difference on Windows Azure's copy is IIS 7.5 has an additional MIME type setting for .svg. Which is something we manually configure into our web.config as we use .svg files. Have to put in a counter entry to remove it before our config.

    <staticContent xdt:Transform="Replace">
                <remove fileExtension=".svg" />
                <mimeMap fileExtension=".less" mimeType="text/css" />
                <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
                <mimeMap fileExtension=".woff" mimeType="application/font-woff" />
                <mimeMap fileExtension=".otf" mimeType="font/opentype" />
                <mimeMap fileExtension=".jsw" mimeType="application/javascript" />
            </staticContent>