【问题标题】:Use HTTP.sys to enable windows authentication #Error: read ECONNRESET ASP.NET Core使用 HTTP.sys 启用 windows 身份验证 #Error: read ECONNRESET ASP.NET Core
【发布时间】:2021-08-18 06:32:56
【问题描述】:

我想使用 Http.sys 启用 Windows 身份验证并使用 POSTman 发送 GET 请求。 我已经输入了我电脑的账号和密码,但是邮递员告诉我这个错误。 不知道发生了什么,谁能告诉我原因?
Configure Windows Authentication in ASP.NET Core
更新 My Purpose
Startup.cs

public void ConfigureServices(IServiceCollection services)
{

            services.AddControllers();
            services.AddAuthentication(HttpSysDefaults.AuthenticationScheme);

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo { Title = "webwinauth", Version = "v1" });
            });
}

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseSwagger();
                app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "webwinauth v1"));
            }

            app.UseHttpsRedirection();

            app.UseRouting();
            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
}

Program.cs


        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder.UseStartup<Startup>()
                    .UseHttpSys(options =>
                    {
                        options.Authentication.Schemes = 
                            AuthenticationSchemes.NTLM | 
                            AuthenticationSchemes.Negotiate;
                        options.Authentication.AllowAnonymous = true;
                    });;
                });

邮递员 Setting about NTLM
错误 Error

【问题讨论】:

  • 您不能将Http.sysasp.net core 一起使用,它与ASP.NET Core Module 不兼容,并且不能与IIS 或IIS Express 一起使用。
  • 您好,请问还有什么可以帮助您的吗?

标签: c# asp.net-core postman windows-authentication http.sys


【解决方案1】:

您不能将Http.sysasp.net core 一起使用,它与ASP.NET Core Module 不兼容,并且不能与IIS 或IIS Express 一起使用。你可以看看here if offical document

注意:你也可以看看offical reference here

Update: 完整的官方样本你可以download from here

希望对你有帮助。

【讨论】:

  • 嗨,我更新了我的问题,图片是我的队友给我看的。我想做同样的事情,但我忘记了整个设置步骤。我希望你能帮助我,谢谢!
  • 好吧,你可以看看complete steps here
  • 我已经为您更新了身份服务器完整示例,您可以从给定的链接获取。
猜你喜欢
  • 1970-01-01
  • 2020-03-23
  • 1970-01-01
  • 2017-11-30
  • 2017-12-31
  • 2019-01-04
  • 2019-04-30
  • 1970-01-01
  • 2018-06-17
相关资源
最近更新 更多