我正在撰写一份有关MVC核心申请的印本。 在此,我使用GET AJAX电话。 www.un.org/Depts/DGACM/index_french.htm 但在向我的当地二等服务器部署之后,我的非洲宇宙航空研究开发机构的呼吁给我留下错误的信息。
任何帮助或建议,为什么要对国际调查局进行这种调查?
GET http://mycrt.companyName/GitLab/GetRackStatus 500 (Internal Server Error) jquery.js:10099
在此,我呼吁阿马齐安会
$( #rackInfo ).click(function () {
var url = GitLab/GetRackStatus ; //http://mycrt.CompanyName/GitLab/GetRackStatus URL also returns same error
$.blockUI();
$.ajax({
url: url,
type: "GET",
success: function (responseHtml) {
$( #rackInfoResults ).replaceWith(responseHtml);
$( #rackInfoResultsError ).hide();
bindEventsOnRacks();
$.unblockUI();
},
error: function (responseHtml) {
$( #rackInfoResults ).hide();
$( #rackInfoResultsError ).show();
$.unblockUI();
}
});
});
这里是我的控制者
public async Task<IActionResult> GetRackStatus()
{
//Controller code
return PartialView("_RackStatusPartialView");
}
这里是我的发射场。 json
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:53400",
"sslPort": 44339
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"MyCRT": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": "true",
"applicationUrl": "https://localhost:5001;http://localhost:5000"
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
"publishAllPorts": true,
"useSSL": true
}
}
}
注:我曾尝试过AJAX中的URL以下,Gives 我的错误之处如下:
http://localhost/GitLab/GetRackStatus
Access to XMLHttpRequest at http://localhost/GitLab/GetRackStatus from origin http://mycrt.companyName has been blocked by CORS policy: No Access-Control-Allow-Origin header is present on the requested resource.
Failed to load resource: net::ERR_FAILED