As suggested by @ancajic i put the below code after connectionString tag in my web.config file and it worked.

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

As said by @elasticman, it is necessary to open IIS Manager -> Mime types -> Add a new mime type with

Extension: .json MIME Type: application/json

But for me that still wasn't enough. I have an ASP.NET MVC 4 application, and I had to modify my root Web.config file.

Insert

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

somewhere inside your

<system.webServer>
    ...
</system.webServer>

Is the file you try to receive in the same domain? Or do you fetch the json from another server? If it is hosted on a different domain, you'll have to use JSONP due to same origin policy.


Option 1

  1. Go to IIs

  2. Select Website

  3. Double Click Mime Type Icon Under IIs

  4. Click Add Link in right hand side

  5. File Name Extension = .json Mime Type = application/json

  6. Click Ok.

Option 2

Update your web.config file like this

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

I hope your problem is resolved


If you are using IIS Express with Visual Studio, IIS Manager won't work for IIS Express. Instead, you need to open this config file from %userprofile%\documents\IISExpress\config\applicationhost.config and insert

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

along with all other pre-defined mime types.