gpt4 book ai didi

c# - "message": "The SSL connection could not be established, see inner exception." in Windows Server 2012 R2

转载 作者:行者123 更新时间:2023-12-04 04:16:10 38 4
gpt4 key购买 nike

我在我的 API 中集成了 3rd 方 API。那个时候出错了。也许这是 SSL 连接问题。

"data": {
"message": "The SSL connection could not be established, see inner exception.",
"data": {},
"innerException": {
"ClassName": "System.Security.Authentication.AuthenticationException",
"Message": "Authentication failed, see inner exception.",
"Data": null,
"InnerException": {
"ClassName": "System.ComponentModel.Win32Exception",
"Message": "The message received was unexpected or badly formatted",
"Data": null,
"InnerException": null,
"HelpURL": null,
"StackTraceString": null,
"RemoteStackTraceString": null,
"RemoteStackIndex": 0,
"ExceptionMethod": null,
"HResult": -2147467259,
"Source": null,
"WatsonBuckets": null,
"NativeErrorCode": -2146893018
},
"HelpURL": null,
"StackTraceString": " at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, ExceptionDispatchInfo exception)\r\n at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.PartialFrameCallback(AsyncProtocolRequest asyncRequest)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Net.Security.SslState.ThrowIfExceptional()\r\n at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)\r\n at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result)\r\n at System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult)\r\n at System.Net.Security.SslStream.<>c.<AuthenticateAsClientAsync>b__47_1(IAsyncResult iar)\r\n at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)",
"RemoteStackTraceString": null,
"RemoteStackIndex": 0,
"ExceptionMethod": null,
"HResult": -2146233087,
"Source": "System.Private.CoreLib",
"WatsonBuckets": null
},
"stackTrace": " at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)\r\n at System.Threading.Tasks.ValueTask`1.get_Result()\r\n at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Threading.Tasks.ValueTask`1.get_Result()\r\n at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask`1 creationTask)\r\n at System.Threading.Tasks.ValueTask`1.get_Result()\r\n at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)\r\n at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)\r\n at weplay.api.Helpers.SexyBaccarat_Game.SexyBaccarat.SexyBaccaratHelpers.SexyBaccarateRegisterAsync(ProfileRequest request) in E:\\Yudiz\\Projects\\W\\WeplayDevOps\\weplay.api\\Helpers\\SexyBaccarat_Game\\SexyBaccarat\\SexyBaccaratHelpers.cs:line 125",
"helpLink": null,
"source": "System.Net.Http",
"hResult": -2146233087}

API代码是
using (var SB_helper = new SBHelpers(Connection))
{
using (var httpClientHandler = new HttpClientHandler())
{
httpClientHandler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;
httpClientHandler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { return true; };
ServicePointManager.SecurityProtocol = (SecurityProtocolType)768 | (SecurityProtocolType)3072;
//send request
using (var httpClient = new HttpClient(httpClientHandler))
{
string bodyParameter = $"cert={SBConst.Cert}&agentId={SBConst.AgentId}&userId={SBConst.UserNamePrefix + request.UserId}&currency={request.Currency}&betLimit={request.BetLimit}&language={request.Language}";
var content = new StringContent(bodyParameter, Encoding.UTF8, "application/x-www-form-urlencoded");
HttpResponseMessage response = await client.PostAsync($"{SBConst.APIURL}{SBConst.Method.CreateMember}", content);
var responseString = await response.Content.ReadAsStringAsync();
dynamic responseOk = JsonConvert.DeserializeObject(responseString);
return response;
}
}
}

此错误出现在实时服务器上。但是在 本地主机 window 10 那工作正常。

有人有与此相关的想法吗?

先感谢您 :)

最佳答案

你解决了这个问题吗?如何 ?
我在公共(public)服务器上也有这个异常:

22:56:23,837 |      HttpGrabber | DEBUG | Grabbing: GET https://shop.westerndigital.com/de-de/products/internal-drives/wd-red-sata-2-5-ssd#WDS200T1R0A
22:56:23,895 | HttpGrabber | DEBUG | System.Net.Http.SocketsHttpHandler.Http2Support: True
22:56:23,901 | HttpGrabber | DEBUG | System.Net.Http.UseSocketsHttpHandler: True
22:56:24,080 | HttpGrabber | ERROR | System.AggregateException: One or more errors occurred. (The SSL connection could not be established, see inner exception.)
---> System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.
---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception.
---> System.ComponentModel.Win32Exception (0x80090326): Le message reçu était inattendu ou formaté de façon incorrecte.
--- End of inner exception stack trace ---
at System.Net.Security.SslStream.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, ExceptionDispatchInfo exception)
at System.Net.Security.SslStream.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslStream.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslStream.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
我发布了另一个使用 Wireshark 进行分析的主题,也许您的答案在此处描述的问题中:
Cipher suites incompatibility of dont net core

关于c# - "message": "The SSL connection could not be established, see inner exception." in Windows Server 2012 R2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60667232/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com