面向500.30的.Net Core Web Windows身份验证

问题描述

我正在尝试使用dotnet Core 3.1.3将react-web应用程序发布到启用Windows身份验证的IIS服务器。我已经在调试模式下成功进行了测试,但是遇到了500.30错误

我试图在此处删除该行,并且该应用程序可以正常运行,而Windows身份验证没有任何功能

   webBuilder.Usehttpsys(options => {
        options.Authentication.Schemes = AuthenticationSchemes.NTLM | AuthenticationSchemes.Negotiate;
        options.Authentication.AllowAnonymous = false;
    });

请帮助告知我应该使用Windows身份验证功能对其进行哪些设置?

UI错误

HTTP Error 500.30 - ANCM In-Process Start Failure

日志错误

enter image description here

以下是有关身份验证设置的一些代码

Startup.cs

public void ConfigureServices(IServiceCollection services)
{            
  services.Configure<IISOptions>(options => { options.AutomaticAuthentication = true; });
  services.AddAuthentication(IISDefaults.AuthenticationScheme);
  services.AddAuthorization();  
            
  services.AddHttpContextAccessor();
  services.AddControllers();
}

Program.cs

        public static IHostBuilder CreateHostBuilder(string[] args) =>
        
        Host.CreateDefaultBuilder(args)
            .ConfigureWebHostDefaults(webBuilder =>
            {
                webBuilder.UseContentRoot(System.IO.Directory.GetCurrentDirectory());
                webBuilder.Usehttpsys(options => {
                       options.Authentication.Schemes = AuthenticationSchemes.NTLM | AuthenticationSchemes.Negotiate;
                       options.Authentication.AllowAnonymous = false;
                   });
                webBuilder.UseIISIntegration();
                webBuilder.UseStartup<Startup>();
            });

launchSettings.json

 "iisSettings": {
    "windowsAuthentication": true,"anonymousAuthentication": false,"iisExpress": {
      "applicationUrl": "http://localhost:59811","sslPort": 44331
    }
  }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)