HttpClient, UseDefaultCredentials, Windows Authentication, .NET Core 2.0+ console application receives 401 Unauthorized

前端 未结 2 1555
情书的邮戳
情书的邮戳 2021-02-12 14:11

I am trying to make an HTTP GET call from a .NET Core 3.0 console application. The endpoint expects Windows Authentication. The endpoint is an in-production .NET Framework 4.5.2

2条回答
  •  清歌不尽
    2021-02-12 14:41

    This workaround works for me add this before creating HttpClient / Handler:

    AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", false);
    

提交回复
热议问题