Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

404 Not Found when I look for .json file in ASP.NET MVC app

My ASP.NET MVC 5 app can't find json files. I'm getting a 404 error when I look for a json file, but if I look for a png file in the same directory it finds that. In web.config I have:

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

Is there anything else I need to do in Visual Studio to find json files?

like image 430
user441521 Avatar asked Apr 09 '14 01:04

user441521


2 Answers

<system.webServer>
 <staticContent>
  <mimeMap fileExtension=".json" mimeType="application/json; charset=UTF-8" />
 </staticContent>
</system.webServer>

See adding .json handler support in IIS.

Also, ensure the request is not going into the routing framework by putting a breakpoint. (since PNG is served, this is probably not an issue)

like image 180
Raja Nadar Avatar answered Oct 19 '22 06:10

Raja Nadar


You need to go into IIS and add a mimetype for it as well as adding it into your web.config file.

like image 20
mnsr Avatar answered Oct 19 '22 06:10

mnsr