Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS error 500.19 for static files in Azure project

Tags:

iis

azure

I have an Azure project with a single webrole that I am trying to get to run properly after upgrading to Windows 8 and Visual Studio 2012.

The problem is with any static content, it returns a HTTP 500 Internal Server Error with this text: "The page cannot be displayed because an internal server error has occurred." This error is presented for any static content (images and javascript), while dynamic content is served fine (all controller actions work fine).

We cannot get IIS to present a detailed error message. The only reference we can find to the error is in the access log, which presents it as a 500 subtype 19 error.

We've tried switching between IIS and IISExpress, same error occurs. We've tried adding all the "show detailed error messages" options to our web.config and IIS Manager. The same error happens on both HTTP and HTTPS endpoints.

What should be my next steps?

like image 474
Vegard Larsen Avatar asked Aug 17 '12 08:08

Vegard Larsen


2 Answers

The culprit has been discovered. By comparing a default web.config with our web.config we discovered this in our web.config:

<system.webServer>
  <staticContent>
    <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
  </staticContent>
</system.webServer>

IIS8 has support for the WOFF built in, while IIS 7 did not. Simply moving this line into a transform solved the issue.

like image 150
Vegard Larsen Avatar answered Nov 06 '22 22:11

Vegard Larsen


I came across this a long time ago and the answer from Vegard Larsen worked great. However, I've since upgraded to osFamily 3 (Windows Server 2012) and found that I was once again getting the 500 error with subtype 19 when deploying to Azure. The fix was to use the following in the transform.

<system.webServer>
  <staticContent xdt:Transform="Insert">
    <remove fileExtension=".woff" />
    <mimeMap fileExtension=".woff" mimeType="application/x-woff" />
  </staticContent>
</system.webServer>

The important part is to remove any existing .woff configuration. That way you can be sure it'll work on any IIS platform/configuration.

like image 30
bojingo Avatar answered Nov 06 '22 23:11

bojingo