C# Can';t在某些Windows XP/Server 2003计算机上建立HTTPS连接

C# Can';t在某些Windows XP/Server 2003计算机上建立HTTPS连接,c#,.net,.net-4.0,C#,.net,.net 4.0,在某些运行Windows XP和Windows Server 2003的计算机上,我们的应用程序存在问题。应用程序在尝试通过HTTPS连接到我们的Web服务时崩溃。事件查看器在崩溃后显示以下内容: Exception Info: System.AccessViolationException Stack: at System.Security.Cryptography.CAPISafe.CertGetCertificateChain(IntPtr, System.Security.Cryp

在某些运行Windows XP和Windows Server 2003的计算机上,我们的应用程序存在问题。应用程序在尝试通过HTTPS连接到我们的Web服务时崩溃。事件查看器在崩溃后显示以下内容:

Exception Info: System.AccessViolationException
Stack:
   at System.Security.Cryptography.CAPISafe.CertGetCertificateChain(IntPtr, System.Security.Cryptography.SafeCertContextHandle, System.Runtime.InteropServices.ComTypes.FILETIME ByRef, System.Security.Cryptography.SafeCertStoreHandle, CERT_CHAIN_PARA ByRef, UInt32, IntPtr, System.Security.Cryptography.SafeCertChainHandle ByRef)
   at System.Security.Cryptography.X509Certificates.X509Chain.BuildChain(IntPtr, System.Security.Cryptography.SafeCertContextHandle, System.Security.Cryptography.X509Certificates.X509Certificate2Collection, System.Security.Cryptography.OidCollection, System.Security.Cryptography.OidCollection, System.Security.Cryptography.X509Certificates.X509RevocationMode, System.Security.Cryptography.X509Certificates.X509RevocationFlag, System.DateTime, System.TimeSpan, System.Security.Cryptography.SafeCertChainHandle ByRef)
   at System.Security.Cryptography.X509Certificates.X509Chain.Build(System.Security.Cryptography.X509Certificates.X509Certificate2)
   at System.Net.Security.SecureChannel.VerifyRemoteCertificate(System.Net.Security.RemoteCertValidationCallback)
   at System.Net.Security.SslState.CompleteHandshake()
   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(System.Net.Security.ProtocolToken, System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.StartSendBlob(Byte[], Int32, System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.ProcessReceivedBlob(Byte[], Int32, System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.StartReadFrame(Byte[], Int32, System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.StartReceiveBlob(Byte[], System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(System.Net.Security.ProtocolToken, System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.StartSendBlob(Byte[], Int32, System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.ProcessReceivedBlob(Byte[], Int32, System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.StartReadFrame(Byte[], Int32, System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.StartReceiveBlob(Byte[], System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(System.Net.Security.ProtocolToken, System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.StartSendBlob(Byte[], Int32, System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.ProcessReceivedBlob(Byte[], Int32, System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.StartReadFrame(Byte[], Int32, System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.StartReceiveBlob(Byte[], System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(System.Net.Security.ProtocolToken, System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.StartSendBlob(Byte[], Int32, System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.ProcessReceivedBlob(Byte[], Int32, System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.StartReadFrame(Byte[], Int32, System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.StartReceiveBlob(Byte[], System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(System.Net.Security.ProtocolToken, System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.StartSendBlob(Byte[], Int32, System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.ProcessReceivedBlob(Byte[], Int32, System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.StartReadFrame(Byte[], Int32, System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.StartReceiveBlob(Byte[], System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(System.Net.Security.ProtocolToken, System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.StartSendBlob(Byte[], Int32, System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.ForceAuthentication(Boolean, Byte[], System.Net.AsyncProtocolRequest)
   at System.Net.Security.SslState.ProcessAuthentication(System.Net.LazyAsyncResult)
   at System.Net.TlsStream.CallProcessAuthentication(System.Object)
   at System.Threading.ExecutionContext.runTryCode(System.Object)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Net.TlsStream.ProcessAuthentication(System.Net.LazyAsyncResult)
   at System.Net.TlsStream.Write(Byte[], Int32, Int32)
   at System.Net.PooledStream.Write(Byte[], Int32, Int32)
   at System.Net.ConnectStream.WriteHeaders(Boolean)
   at System.Net.HttpWebRequest.EndSubmitRequest()
   at System.Net.HttpWebRequest.CheckDeferredCallDone(System.Net.ConnectStream)
   at System.Net.HttpWebRequest.GetResponse()
   at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(System.Net.WebRequest)
   at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(System.Net.WebRequest)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(System.String, System.Object[])
   at {METHOD THAT CALLS WEBSERVICE}

webservice通信由服务引用处理。我们尝试调用哪个Web服务并不重要。当我们使用完全不同的服务器时,甚至会发生错误。

我们刚刚解决了这个问题。似乎只有在构建应用程序的计算机安装了Visual Studio 2013时,才会出现此问题


编辑:这是一个错误的假设。我们在应用程序中使用libcef,这似乎是问题的根本原因。在没有VS2013的机器上构建的版本包含错误的libcef版本。如果出现这种情况,应用程序将在没有CEF功能的情况下继续运行,因此我们假设它正在工作。

您能找到解决方案吗?@bradmo遗憾的是不能。我们暂时改用旧版本的CEF。2062分支上不会出现此问题。我可以通过打开一个CEF浏览器实例并在应用程序中发出任何请求之前加载一个页面来解决这个问题。但这似乎是一个棘手的解决方案。