![](/img/trans.png)
[英]I am facing HTTP Error 502.5 error while publishing Dotnet core 2.0 mvc application in IIS 10
[英]IIS 10 AJAX not working for dotnet core 5 MVC
我正在编写一个 asp dot.net 核心 MVC 应用程序。 我在这里使用 GET AJAX 调用。 当我从 Visual Studio 运行我的应用程序时,它可以正常工作。 但是在部署到我的本地 IIS 10 服务器后,我的 AJAX 调用给我以下错误消息。
为什么在 IIS 上发生这种情况的任何帮助或建议?
GET http://mycrt.geotab/GitLab/GetRackStatus 500 (Internal Server Error) jquery.js:10099
这是我的 AJAX 电话
$('#rackInfo').click(function () {
var url = 'GitLab/GetRackStatus'; //http://mycrt.geotab/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();
}
});
});
这是我的 controller
public async Task<IActionResult> GetRackStatus()
{
//Controller code
return PartialView("_RackStatusPartialView");
}
这是我的 launchSettings.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,这给了我以下错误
http://localhost/GitLab/GetRackStatus
Access to XMLHttpRequest at 'http://localhost/GitLab/GetRackStatus' from origin 'http://mycrt.geotab' 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
这是我的 IIS 个人资料
这可能发生在几个问题上。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.