Return status code 404 with Dymaic JSON data RRS feed

  • Question

  • User647946479 posted

    I write a sample Demo that use ajax to get  Json from DB Data.

    In Visual Studio Developer Mode,It's work,

    but I published the Demo in  IIS, It will get 404 code.

    I  modified web.config   "<mimeMap fileExtension=".json" mimeType="application/json; charset=UTF-8" />" ,

    I found it's for static json data.

    How shall I do??

    this's my code:

    public ActionResult Test()
        DemoMachineEntities DB = new DemoMachineEntities();

       List<MachineData> Machines = DB.MachineData.ToList();
       return Json(Machines, JsonRequestBehavior.AllowGet);

    //================================Call Test()

    $.ajaxSetup({ cache: false });
    url: '/Home/Test',
    type: 'GET',
    success: function (response) {  


    error: function (error) {


    Friday, July 5, 2019 2:16 AM

All replies

  • User753101303 posted


    You published  your app to the root of a web site or to an application folder under a web site root. In this later case the url is site.com/app/Home/test rather than site.com/Home/Test which could explain the problem.

    Friday, July 5, 2019 8:37 AM
  • User1520731567 posted

    Hi box621863,

    Error 404 on an MVC application indicates the IIS App is not configured correctly.

    This assumes the all the necessary files have been moved. ie the bin folder exists.

    Maybe related to your server and site name.

    Anyway, see the deployment docs for troubleshooting steps:


    Best Regards.

    Yuki Tao

    Monday, July 8, 2019 9:23 AM