loading .json files generates 404 errors loading .json files generates 404 errors json json

loading .json files generates 404 errors


I too found Ahmed Sabbour's blog post helpful, but it created an additional problem for me. Whilst the fix worked for the Azure Web App when I then tried to run the app locally it died horribly, throwing HTTP 500.19 everywhere. It took me a while to figure out how to fix this whilst maintaining a single web.config. The solution was (albeit a bit of a fudge) to remove the fileExtension first and then add it back in:

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

For my narrow purposes this was fine and I hope this might save someone time trying to figure this out.


Citing Ahmed Sabbour with his blog post http://blogs.msdn.com/b/africaapps/archive/2013/06/07/how-to-serve-static-json-files-from-a-windows-azure-website.aspx you have to do the following:

"If you upload a .json file to your Windows Azure website and try to access it, it would give you a 404 File Not Found error, because the MIME Type of .json is not set by default. This also applies in general to any file that might need a specific MIME Type.

To fix this issue, FTP into your website and upload the following Web.config file which will set the correct MIME types. If you already have a Web.config file in place, just add the below to the appropriate section.

<?xml version="1.0"?><configuration>    <system.webServer>        <staticContent>            <mimeMap fileExtension=".json" mimeType="application/json" />     </staticContent>    </system.webServer></configuration> 

". I did this and the 404 was gone.


It appears that Azure (Cloud Services, at least) knows how to serve JSON from a deployed ASP.NET MVC project. The problem in my case was that the Build Action on the JSON file's property page was not set correctly. Changing the Build Action to Content fixed it for me.