English 中文(简体)
IIS 10 AJAX not work for dotnet core 5 MVC
原标题:IIS 10 AJAX not working for dotnet core 5 MVC

我正在撰写一份有关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
最佳回答

在若干问题上可以做到这一点。

  1. Check the DB connection is ok for your IIS server code.
  2. Check the permission about your folder if u retrieve any file or data from the specific folder.
  3. check the validation of your URL that you are posting by ajax to your controller that it post the valid data to the controller and the incoming response is valid too.
问题回答

暂无回答




相关问题
Session Management with Windows Authentication

In an ASP.NET web app, using Integrated Windows Authentication, is the session tied to the windows identity? In other words, if I login (using IWA) to the app, and the app stores some "stuff" in my ...

Using Elmah with Cassini

Does anyone know if I can use Elmah with Visual Studio build-in web server(aka Cassini)? I get it working easily on IIS, but using same configuration, it doesn t work with Cassini. When I requested ...

Setting hostname in IIS, include www?

I want to set the hostname for a website I m adding in IIS 7, however do I include the www in the hostname or not? because I want both www.mysite.com and mysite.com both to point to mysite on the ...

inetpub versus any other folder

I ve run websites out of inetpub, as well as from folders just residing on the C: drive. I wonder, are there any definitive advantages to running websites out of inetputwwwroot?

IIS 6.0 hangs when serving a web-service

I am having issues with one of our web-services. It works fine on my development machine (win XP) whether I host it as a separate application or using cassini from Visual studio. Once I deploy on the ...

热门标签