調用第三方接口實現自動登陸時報錯如下:
System.Net.WebException: 基礎連接已經關閉: 接收時發生錯誤。 ---> System.ComponentModel.Win32Exception: 因為算法不同,客戶端和服務器無法通信。
在 System.Net.SSPIWrapper.AcquireCredentialsHandle(SSPIInterface SecModule, String package, CredentialUse intent, SecureCredential scc)
在 System.Net.Security.SecureChannel.AcquireCredentialsHandle(CredentialUse credUsage, SecureCredential& secureCredential)
在 System.Net.Security.SecureChannel.AcquireClientCredentials(Byte[]& thumbPrint)
在 System.Net.Security.SecureChannel.GenerateToken(Byte[] input, Int32 offset, Int32 count, Byte[]& output)
在 System.Net.Security.SecureChannel.NextMessage(Byte[] incoming, Int32 offset, Int32 count)
在 System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
在 System.Net.TlsStream.CallProcessAuthentication(Object state)
在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)
在 System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)
在 System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size)
在 System.Net.ConnectStream.WriteHeaders(Boolean async)
--- 內部異常堆棧跟蹤的結尾 ---
在 System.Net.HttpWebRequest.GetResponse()
在 W.Common.APILogin.RES_GET.GetURL(String url)
在 W.Common.APILogin.ApiLogin.GetNewWxAccessToken(String code)
在 WebApp.Areas.Webservers.Controllers.UserController.WeChatLogin(Int32 region, Int32 language)
解決辦法:
調整IIS的TLS版本
使用IISCrypto.exe軟件 將 TLS重新設置一下即可。