异常信息: The SSL connection could not be established, see inner exception.InnerExceptionMessage:Authentication failed because the remote party has closed the transport stream. 我这跟你一样的问题,大佬解决了没有啊,跪求!!!
.net core 3.1 服务器端获取用户信息经常出现Authentication failed?.net core 3.1 服务器端获取用户信息经常出现 System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. ---> System.IO.IOException: Authentication failed because the remote party has closed the transport stream. at System.Net.Security.SslStream.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslStream.PartialFrameCallback(AsyncProtocolRequest asyncRequest) --- End of stack trace from previous location where exception was thrown --- at System.Net.Security.SslStream.EndProcessAuthentication(IAsyncResult result) at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization) --- End of stack trace from previous location where exception was thrown --- at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts) 不是必然,是经常出现 ,请问是什么问题啊 请求代码 var hander = new HttpClientHandler(); hander.ServerCertificateCustomValidationCallback = (message, certificate2, arg3, arg4) => true; HttpClient webClient = new HttpClient(hander); var jsonString = await (await webClient.GetAsync( $"https://api.weixin.qq.com/sns/jscode2session?appid={SystemSetting.WeClientMiniAppID}&secret={SystemSetting.WeClientMiniAppSecret}&js_code={request.WeCode}&grant_type=authorization_code" )).Content.ReadAsStringAsync();
2021-08-09