当前位置: 代码迷 >> Web Service >> System.Net.WebException: 基础连接已经关闭: 接收时发生异常。 -> System.Security.Cryptography.Cr
  详细解决方案

System.Net.WebException: 基础连接已经关闭: 接收时发生异常。 -> System.Security.Cryptography.Cr

热度:246   发布时间:2016-05-02 02:18:05.0
System.Net.WebException: 基础连接已经关闭: 接收时发生错误。 ---> System.Security.Cryptography.Cr
其他服务器同样代码没问题,重装服务器后,再把原来的网站发布上去就出现错误了,不知道是不是少配置了什么。
通过webservice去请求外国的一个网站出错了,其他服务器没事
错误如下:
System.Net.WebException: 基础连接已经关闭: 接收时发生错误。 ---> System.Security.Cryptography.CryptographicException: 找不到对象或属性。

   在 System.Net.Security.SecureChannel.VerifyRemoteCertificate(RemoteCertValidationCallback remoteCertValidationCallback)
   在 System.Net.Security.SslState.CompleteHandshake()
   在 System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
   在 System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
   在 System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
   在 System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
   在 System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
   在 System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
   在 System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
   在 System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
   在 System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
   在 System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
   在 System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
   在 System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
   在 System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
   在 System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
   在 System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
   在 System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
   在 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.runTryCode(Object userData)
   在 System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
   在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   在 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.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
   在 System.Net.WebClient.DownloadString(Uri address)
   在 System.Net.WebClient.DownloadString(String address)
   在 LMS.BLL.HS_OrderTranpostInfoBLL.AutoSaveTranNumJP(String strId) 位置 g:\公司源码\BLL\HS_OrderTranpostInfoBLL.cs:行号 153
   在 LMS.BLL.HS_OrderTranpostInfoBLL.AutoSaveTranInfo(String orderId, String strNum) 位置 g:\公司源码\BLL\HS_OrderTranpostInfoBLL.cs:行号 64
   在 GetOrderTrack.GetOrderTrackByTranNum(String TranNum) 位置 d:\web\WebSite\App_Code\GetOrderTrack.cs:行号 47

经查看错误在这里:
 WebClientEX wc = new WebClientEX();
            wc.Encoding = Encoding.UTF8;
            string str = wc.DownloadString("https://trackings.post.japanpost.jp/services/srv/search/?requestNo1=" + strId + "&search.x=0&search.y=0");
调用这个的时候出现错误。
不知道是什么原因?



------解决思路----------------------
对方关闭了连接呗。
------解决思路----------------------
多测试一下,从“System.Net.WebException: 基础连接已经关闭: 接收时发生错误。”的错误来看,感觉是对方服务关闭连接了。
  相关解决方案