HTTP Error 500.24 - Internal Server Error : system.web/identity@impersonate is set to true

HTTP Error 500.24 - Internal Server Error : system.web/identity@impersonate is set to true

我创建了一个 ASP.NET Web 应用程序 MVC Core 2.2 项目。然后我在 IIS Express 中 运行 它。但是我收到以下错误:

HTTP Error 500.24 - Internal Server Error An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.

Most likely causes: system.web/identity@impersonate is set to true.

Things you can try: If the application supports it, disable client impersonation. If you are certain that it is OK to ignore this error, it can be disabled by setting system.webServer/validation@validateIntegratedModeConfiguration to false.

这是我的 lunchSetting.json 代码:

{
  "iisSettings": {
    "windowsAuthentication": true,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:50764",
      "sslPort": 0
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "launchUrl": "http://localhost:50764",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "WebApplication2": {
      "commandName": "Project",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "applicationUrl": "https://localhost:5001;http://localhost:5000"
    }
  }
}

您的设置有问题。 "windowsAuthentication": true 不应该在那里。它默认设置为 false,除非您尝试设置和使用 Windows 身份验证。设置 Windows 身份验证需要特殊步骤,包括在 program.cs 文件中包含 forwardWindowsAuthToken="True".UseIISIntegration()web.config 文件。如果您不想这样做,只需设置 "windowsAuthentication": false.

显然不是发帖人的问题,因为他写道,他通过更改 .NET Core 版本修复了它;但我发布了对我有用的内容,以防万一。

打开 IIS 并找到您的默认网站:

那么你有两个选择;第一个最快。

1.认证

单击身份验证图标:

右键单击 ASP.NET 模拟并禁用它。

2。配置编辑器

打开配置编辑器:

配置编辑器打开;单击左上角的下拉菜单并选择系统。web/identity:

将模拟设置为 false:

一切顺利!

我收到了与 OP 相同的错误。我的解决方案是将 Web.config 文件添加到我的 ASP.NET 核心 Web 应用程序的根文件夹中,内容为 XML:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>  
    <system.web>
      <identity impersonate="false"/>
    </system.web>
</configuration>

在 StartUp.cs 中创建 .net 核心应用程序时,您必须发表评论 //app.UseAuthorization(); 然后 运行 您的应用程序将完美运行。