Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure deployment with .json file extension

Tags:

json

azure

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>
like image 592
gevjen Avatar asked Dec 12 '22 02:12

gevjen


1 Answers

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.

like image 162
Jonathan McIntire Avatar answered Jan 02 '23 08:01

Jonathan McIntire