Hi I am calling a get json to receive data and after I publish my project to IIS server the below request suddenly gives me an 404 error. Everything works fine in visual studio.
public IActionResult GetDataAll()
{
using (PrognoseDbContext prognoseDbContext = new PrognoseDbContext())
{
var data1 = prognoseDbContext.CprPrognoseSamlet.ToList();
return Json(data1);
}
}
I can read from other posts that I shouldn't hardcode the URL because that can cause issues so I tried not to but it still does not work. So how can I fix the problem?
This is my javascript calling my controller:
$.getJSON( "@Url.Action("GetDataAll", "Home")", function (data1)
This is the error I get:
Failed to load resource: the server responded with a status of 404 (Not Found) at Object. (highcharts.src.js:224) at B (highcharts.src.js:1668) at Object.r [as error] (highcharts.src.js:246) at highstock.src.js:21 at highstock.src.js:9