gevjen
gevjen

Reputation: 675

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>

Upvotes: 4

Views: 4098

Answers (1)

Jonathan McIntire
Jonathan McIntire

Reputation: 2675

Adding

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

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.

Upvotes: 13

Related Questions