gevjen gevjen - 5 months ago 12
JSON Question

Azure deployment with .json file extension

We are deploying an azure package where we have a static .json file. We have this working through the azure emulator and locally. but our application just spins when we run it in azure. We are getting a 404 on the app.json file. We have added the mime type to our local iis with the appropriate handler, below is what we have in our web.config. We have set the mime type of application/x-javascript but that didnt work either.

<system.webServer>
<staticContent>
<mimeMap fileExtension=".json"
mimeType="text/html" />
</staticContent>
<handlers>
<add name="JSON"
path="*.json"
verb="*"
modules="IsapiModule"
scriptProcessor="%path%\asp.dll"
resourceType="Unspecified"
preCondition="bitness64" />
</handlers>
</system.webServer>

Answer

Adding

<system.webServer>
  <staticContent>
    <mimeMap fileExtension=".json" mimeType="text/html" />
  </staticContent>
</system.webServer>

to my web.config in an Azure instance worked just fine. Most likely, your deployed web.config isn't configured properly. To check it out, enable RDP, connect to your Azure instance and browse to your web.config. Then you can fiddle with your web.config until you get things working.

Because you're serving up a static .json file, you don't need to add a .json HTTP handler. Also, the offical mime type for .json is application/json.

Comments