我訪問它的SSL認證的web服務器託管的webserivce https://www.example.net/somewebservice/somemethod.asmx這是HTTPS服務器上託管的訪問web服務
但是,當我創建一個代理類,並使用C#使用它:我收到此錯誤
事件類型:錯誤 事件源:XXXX 事件類別:無 事件ID:0 日期:22/08/2011 時間:14時15分53秒 用戶:N/A 計算機:XXXX 描述: System.Net.WebException:底層連接已關閉:無法建立SSL/TLS安全通道的信任關係。 ---> System.Security.Authentication.AuthenticationException:根據驗證過程,遠程證書無效。 在System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken消息,AsyncProtocolRequest asyncRequest,異常的異常) 在System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken消息,AsyncProtocolRequest asyncRequest) 在System.Net.Security.SslState.StartSendBlob (Byte [] incoming,Int32 count,AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.ProcessReceivedBlob(Byte [] buffer,Int32 count,AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartReadFrame(Byte []緩衝區,Int32 readBytes,AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartReceiveBlob(Byte [] buffer,AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken消息,AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartSendBlob(Byte [] incoming,Int32 count,AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.ProcessReceivedBlob(Byte [] buffer,Int32 count,AsyncProtocolRequest asyncRequest ) at System.Net.Security.SslState.StartReadFrame(Byte [] buffer,Int32 readBytes,AsyncProtocolRequest asyncRequest) at System.Net.System.Net.Security.SslState.StartReceiveBlob(Byte [] buffer,AsyncProtocolRequest asyncRequest) 。 Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken消息,AsyncProtocolRequest異步請求) at System.Net.SecurityBlocks(Byte [],緩衝區,Int32計數,AsyncProtocolRequest異步請求) at System.Net.Security.SslState.StartReadFrame(Byte [] buffer,Int32 readBytes,AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartReceiveBlob(Byte [] buffer,AsyncProtocolRequest asyncRequest ) at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message,AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartSendBlob(Byte [] incoming,Int32 count,AsyncProtocolRequest asyncRequest) at System.Net.Security。 SslState.ProcessReceivedBlob(Byte [] buffer,Int32 count,AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartReadFrame(Byte [] buffer,Int32 readBytes,AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartReceiv eBlob(Byte [] buffer,AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message,AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartSendBlob(Byte [] incoming,Int32 count,AsyncProtocolRequest asyncRequest ) at System.Net.Security.SslState.ProcessReceivedBlob(Byte [] buffer,Int32 count,AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartReadFrame(Byte [] buffer,Int32 readBytes,AsyncProtocolRequest asyncRequest) at System .Net.Security。SslState.StartReceiveBlob(Byte []緩衝區,AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartSendBlob(Byte [] incoming,Int32 count, AsyncProtocolRequest asyncRequest) 在System.Net.Security.SslState.ForceAuthentication(布爾receiveFirst,字節[]緩衝液,AsyncProtocolRequest asyncRequest) 在System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult) 在System.Net.TlsStream.CallProcessAuthentication (對象狀態) at System.Threading.ExecutionContext.runTryCode(Object userData) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code,CleanupCode backoutCode,Object us在System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext,ContextCallback回調,對象狀態) 在System.Net.TlsStream.ProcessAuthentication() LazyAsyncResult result) at System.Net.TlsStream.Write(Byte [] buffer,Int32 offset,Int32 size) at System.Net.PooledStream.Write(Byte [] buffer,Int32 offset,Int32 size) at System.Net .ConnectStream.WriteHeaders(布爾異步) ---內部異常堆棧跟蹤--- 在System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest請求) 在System.Web.Services.Protocols.HttpWebClientProtocol的末尾。 GetWebRes ponse(WebRequest的要求) 在System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke在
謝謝Yahia。我將安裝證書並測試 – Sathish
CertificatePolicy現在已過時。改用ServerCertificateValidationCallback。沒有,仍然沒有生產:-) http://msdn.microsoft.com/en-us/library/vstudio/system.net.servicepointmanager.servercertificatevalidationcallback(v=vs.100).aspx – Jaans