string url=$" https://api.weixin.qq.com/sns/oauth2/access_token? Appid={appid} & amp; Secret={appSecret} & amp; Code={code} & amp; Grant_type=authorization_code ";
Var. Client=_httpClientFactory CreateClient ();
Var response=await client. SendAsync (new HttpRequestMessage (HttpMethod. The Get url));
if (! The response. IsSuccessStatusCode) return null;
Var result=await the response. The content. ReadAsStringAsync ();
OauthTokenResult accessToken=JsonConvert. DeserializeObject(result);
_logger. LogWrite ($" access authorization AccessToken: {result} ");
return accessToken;
2020/02/29 20:16:48. 081 | ERROR |=======================================================================
User IP: 119.44.61.188
Page anomalies: https://api.barendao.com/api/AccessToken/WeChat
Error sources: System.Net.Http
Abnormal information: The SSL connection could not be established, see inner exception.
The exception stack:
At System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore (Stream, Stream, SslClientAuthenticationOptions sslOptions, CancellationToken CancellationToken)
The at System.Net.Http.HttpConnectionPool.ConnectAsync (HttpRequestMessage request, Boolean allowHttp2, CancellationToken CancellationToken)
The at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync (HttpRequestMessage request, CancellationToken CancellationToken)
The at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync (HttpRequestMessage request, CancellationToken CancellationToken)
The at System.Net.Http.HttpConnectionPool.SendWithRetryAsync (HttpRequestMessage request, Boolean doRequestAuth, CancellationToken CancellationToken)
The at System.Net.Http.RedirectHandler.SendAsync (HttpRequestMessage request, CancellationToken CancellationToken)
The at System.Net.Http.DiagnosticsHandler.SendAsync (HttpRequestMessage request, CancellationToken CancellationToken)
At Microsoft. Extensions. Http. Logging. LoggingHttpMessageHandler. SendAsync (HttpRequestMessage request, CancellationToken CancellationToken)
At Microsoft. Extensions. Http. Logging. LoggingScopeHttpMessageHandler. SendAsync (HttpRequestMessage request, CancellationToken CancellationToken)
The at System.Net.Http.HttpClient.FinishSendAsyncBuffered (Task 1 sendTask `, HttpRequestMessage request, CancellationTokenSource CTS, Boolean disposeCts)
The at Barendao. WeChat. OAuths. OAuthHandler. GetOauthTokenAsync (String appID, String appSecret, String code) in E: \ \ canxinSoft \ PrintingNet \ SRC \ V2 Utility \ Barendao WeChat \ OAuths \ OAuthHandler cs: line 33
The at Barendao. WebApi. Controllers. AccessTokenController. Login (WeChatLoginModel model) in E: \ canxinSoft \ PrintingNet \ SRC \ V2 \ Barendao WebApi \ Controllers \ AccessTokenController cs: line 56
The at lambda_method (Closure, Object)
At Microsoft. Extensions. Internal. ObjectMethodExecutorAwaitable. Awaiter. GetResult ()
At Microsoft. AspNetCore. Mvc. Proceeds. ActionMethodExecutor. AwaitableObjectResultExecutor. Execute (IActionResultTypeMapper mapper, ObjectMethodExecutor executor, the Object controller, Object [] the arguments)
At Microsoft. AspNetCore. Mvc. Proceeds. ControllerActionInvoker. & lt; InvokeActionMethodAsync> G__Awaited | 12 _0 (ControllerActionInvoker invoker, ValueTask ` 1 actionResultValueTask)
At Microsoft. AspNetCore. Mvc. Proceeds. ControllerActionInvoker. & lt; InvokeNextActionFilterAsync> 10 _0 g__Awaited | (ControllerActionInvoker invoker, Task lastTask, State next, and the Scope the Scope, Object State, Boolean isCompleted)
At Microsoft. AspNetCore. Mvc. Proceeds. ControllerActionInvoker. Rethrow (ActionExecutedContextSealed context)
At Microsoft. AspNetCore. Mvc. Proceeds. ControllerActionInvoker. Next (State& Next, Scope& The scope, Object& The state, Boolean& IsCompleted)
At Microsoft. AspNetCore. Mvc. Proceeds. ControllerActionInvoker. & lt; InvokeInnerFilterAsync> G__Awaited | 13 _0 (ControllerActionInvoker invoker, Task lastTask, State next, and the Scope the Scope, Object State, Boolean isCompleted)
At Microsoft. AspNetCore. Mvc. Proceeds. ResourceInvoker. & lt; InvokeNextExceptionFilterAsync> 25 _0 g__Awaited | (ResourceInvoker invoker, Task lastTask, State next, and the Scope the Scope, Object State, Boolean isCompleted)
=======================================================================
CodePudding user response:
The