Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR 404.3 Not Found for JSON file

I have been getting the "ERROR 404.3 Not Found" for JSON file that I am calling using AJAX call on "Internet Information Services 7.5" even after I have activated all the "Application Development Features". Other than JSON file, all other files are getting loaded.

I am running an HTML page on IIS server on my local machine.

If I open the file directly then there is no problem at all. When I host the files on an online server it works fine.

Any quick help will be much appreciated.

like image 849
Nitin Suri Avatar asked Apr 11 '13 08:04

Nitin Suri


4 Answers

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>
like image 165
Himanshu Avatar answered Nov 15 '22 09:11

Himanshu


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>
like image 32
ancajic Avatar answered Nov 15 '22 08:11

ancajic


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.

like image 28
elasticman Avatar answered Nov 15 '22 10:11

elasticman


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

like image 12
Udara Kasun Avatar answered Nov 15 '22 08:11

Udara Kasun