Use HTTP.sys to enable windows authentication #Error: read ECONNRESET ASP.NET Core
Use HTTP.sys to enable windows authentication #Error: read ECONNRESET ASP.NET Core
我想使用 Http.sys 启用 windows 身份验证并使用 POSTman 发送 GET 请求。
我已经输入了我电脑的帐号和密码,但是POSTman告诉我这个错误。
不知道发生了什么,有人能告诉我原因吗?
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;
});;
});
邮递员[=31=]
Setting about NTLM
错误
Error
您不能将 Http.sys
与 asp.net core
一起使用,它与 ASP.NET Core Module
不兼容,并且不能与 IIS 或 IIS Express 一起使用。你可以看看here if offical document.
注:你也可以看看offical reference here
Update:
Complete official sample you can download from here
希望对您有所帮助。
我想使用 Http.sys 启用 windows 身份验证并使用 POSTman 发送 GET 请求。
我已经输入了我电脑的帐号和密码,但是POSTman告诉我这个错误。
不知道发生了什么,有人能告诉我原因吗?
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;
});;
});
邮递员[=31=]
Setting about NTLM
错误
Error
您不能将 Http.sys
与 asp.net core
一起使用,它与 ASP.NET Core Module
不兼容,并且不能与 IIS 或 IIS Express 一起使用。你可以看看here if offical document.
注:你也可以看看offical reference here
Update:
Complete official sample you can download from here
希望对您有所帮助。