Nitin Suri
Nitin Suri

Reputation: 1010

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.

Upvotes: 66

Views: 56295

Answers (8)

Udara Kasun
Udara Kasun

Reputation: 2216

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

Upvotes: 12

BadHeuristics
BadHeuristics

Reputation: 319

To solve this problem with an Azure App Service:

Use FTP or the Kudu dashboard to add this file one level above wwwroot--

/site/applicationHost.xdt:

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <system.webServer>
    <staticContent>
      <mimeMap fileExtension=".json" mimeType="application/json" xdt:Transform="InsertBefore(/configuration/system.webServer/staticContent/*[1])" />
    </staticContent>
  </system.webServer>
</configuration>

Then, under Application settings in the Azure Portal, add a Handler mapping:

.json      C:\WINDOWS\system32\inetsrv\asp.dll

Upvotes: 0

Antonio Garcia Marin
Antonio Garcia Marin

Reputation: 486

I haven't the same problem but for me (Windows Server 2003 IIS 6) the MIME type application/json not work. I use text/plain and work perfect (You not need restart the server)

Upvotes: 0

xqzh76
xqzh76

Reputation: 91

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.

Upvotes: 9

RasoolLotfi
RasoolLotfi

Reputation: 326

I've applied the following settings on the IIS was right.


1.Open IIS Manager

2.Display properties for the IIS Server

3.Click MIME Types and then add the JSON extension:

File name extension: .json

MIME type: application/json

4.Go back to the properties for IIS Server

5.Click on Handler Mappings

Add a script map

Request path: *.json

Executable: C:\WINDOWS\system32\inetsrv\asp.dll Name: JSON

Upvotes: 6

Himanshu
Himanshu

Reputation: 2361

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>

Upvotes: 112

AndroC
AndroC

Reputation: 4884

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>

Upvotes: 33

elasticman
elasticman

Reputation: 641

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.

Upvotes: 28

Related Questions