Use HTTP.sys to enable windows authentication #Error: read ECONNRESET ASP.NET Core

804 views Asked by At

I want to use Http.sys to enable windows authentication and use POSTman to send GET request. I already enter my computer's account and password,but POSTman told me this error. Having no idea what happened,somebody can tell me the reason?
Configure Windows Authentication in ASP.NET Core
UPDATE 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;
                    });;
                });

POSTman Setting about NTLM
ERROR Error

1

There are 1 answers

3
Md Farid Uddin Kiron On BEST ANSWER

You cannot use Http.sys with asp.net core its not compatible with the ASP.NET Core Module and can't be used with IIS or IIS Express. You could have a look here if offical document.

enter image description here

Note: You could also have a look offical reference here

Update: Complete official sample you can download from here

Hope it would help you.