2014-04-28 57 views
5

这种情况发生在sslStream.AuthenticateAsServer(serverCertificate, true, SslProtocols.Default, true); 调用中。验证失败,因为远程方已关闭传输流

我正在尝试做客户端认证。我控制客户端和服务器,都是通过sslstream的C#。 当我使用nodejs服务器时,它完美地工作。但我不能让服务器端在c#中可靠地工作,出于某种原因。很明显,ssl认证需要等待客户端选择客户端证书,但显然这不是c#sslstream类的内置功能? 我已经尝试过呼叫之前这样做,但它仍然立即错误出在电话:

enter image description here

我不介意在IE的安全问题。没关系。我担心sslstream似乎根本不适用于这样一个基本的szenario。从WCF跟踪

错误:

System.Net Error: 0 : [7928] Exception in AppDomain#13869071::UnhandledExceptionHandler - Authentication failed because the remote party has closed the transport stream.. at System.Net.Security.SslState.ValidateCreateContext(Boolean isServer, String targetHost, SslProtocols enabledSslProtocols, X509Certificate serverCertificate, X509CertificateCollection clientCertificates, Boolean remoteCertRequired, Boolean checkCertRevocationStatus, Boolean checkCertName) at System.Net.Security.SslStream.AuthenticateAsServer(X509Certificate serverCertificate, Boolean clientCertificateRequired, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation)

+0

可能是因为这样,不知道如何解决:吊销功能无法检查吊销证书 – Blub

+0

OK,就是这样,我禁用CLR检查。 – Blub

+0

hm不,IE仍然在我的服务器端导致这个问题。我添加了wcf跟踪 – Blub

回答

1

添加下面的代码,帮助我克服了这个问题(我运行在.NET 4.5.1应用程序)。

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11; 
相关问题