0

我想使用 Http.sys 启用 Windows 身份验证并使用 POSTman 发送 GET 请求。我已经输入了我的电脑账号和密码,但是邮递员告诉我这个错误。不知道发生了什么,谁能告诉我原因?
在 ASP.NET Core 中配置 Windows 身份验证
更新 我的目的
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();
            });
}

程序.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 关于 NTLM
ERROR 错误的设置

4

1 回答 1

0

您不能Http.sysasp.net core 它不兼容的ASP.NET Core ModuleIIS 或 IIS Express 一起使用。官方文档可以看这里。

在此处输入图像描述

注意:您也可以在这里查看官方参考

Update:完整的官方示例,您可以从这里下载

希望它会帮助你。

于 2021-08-18T06:49:42.970 回答