Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/272.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# &引用;“讯息”:&引用;无法建立SSL连接,请参阅内部异常。”;在Windows Server 2012 R2中_C#_Api_Ssl_.net Core - Fatal编程技术网

C# &引用;“讯息”:&引用;无法建立SSL连接,请参阅内部异常。”;在Windows Server 2012 R2中

C# &引用;“讯息”:&引用;无法建立SSL连接,请参阅内部异常。”;在Windows Server 2012 R2中,c#,api,ssl,.net-core,C#,Api,Ssl,.net Core,我在API中集成了第三方API。那一次发生了错误。这可能是SSL连接问题 "data": { "message": "The SSL connection could not be established, see inner exception.", "data": {}, "innerException": { "ClassName": "System.Security.Authentication.AuthenticationException", "Message": "Auth

我在API中集成了第三方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}
此错误发生在live server上。但是在localhostwindows10上运行良好

有人知道这件事吗


提前感谢:)

您是否解决了此问题?怎么做

我在公共服务器上也有此例外:

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发布了另一个分析主题,也许你的答案在这里描述的问题中:


您使用的是哪个框架版本?我希望您可以在没有黑客攻击的情况下设置SecurityProtocol。内部异常是什么?“收到的消息是意外的或格式不正确的”您可以使用WireShark或Fiddler转换身份验证请求/响应吗?dotnet core 2.0@Rene我怀疑证书有问题,您部署到的服务器上的证书或与您收到的证书一起卸载的证书。也许忽略ServerCertificateCustomValidationCallback事件中向您抛出的内容并不是诊断此问题的最佳方法。记录错误参数中的错误和/或提供的证书。其中一个问题可能会有所帮助:
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)