c# netcore调用接口报错异常提示信息:

Status(StatusCode="Internal", Detail="Error starting gRPC call. HttpRequestException: Requesting HTTP version 2.0 with version policy RequestVersionOrHigher while unable to establish HTTP/2 connection.

原因:

电脑开启代理,导致异常

解决:

修改HttpClient 代理,Startup.cs 添加 HttpClient.DefaultProxy = new WebProxy(); 即可

 /// <summary>
 ///
 /// </summary>
 /// <param name="services"></param>
 public void ConfigureServices(IServiceCollection services)
 {
     HttpClient.DefaultProxy = new WebProxy();
 }

Logo

一站式 AI 云服务平台

更多推荐