How to serve up .json files from a Windows Azure Website

So it turns out that Windows Azure Websites won’t serve up static .json files by default, no matter how many times you hit F5 !

If you try to access a file you’ll see a 404 File Not Found Error, because the MIME Type of .json is not set by default. This also applies  for other “non-standard” file that  need a specificMIME Type such as mp3, csv etc.

To fix this issue you need to set the correct MIME types in your web.config file and redeploy – easy when you know how!

<?xml version="1.0"?>

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

More information on configuring MIME types in IIS here..

http://www.iis.net/configreference/system.webserver/staticcontent/mimemap

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s