AuthenticateAsServer很慢

时间:2013-10-09 13:28:39

标签: c# ssl https

sslStream = new SslStream(tcpclientStream, false);
Stopwatch c = new Stopwatch();
c.Start();

try
{
    sslStream.AuthenticateAsServer(_certificate, false, SslProtocols.Tls | SslProtocols.Ssl3 | SslProtocols.Ssl2, false);
}
catch (Exception)
{
    sslStream.Close();
    clientStreamReader.Close();
    connectStreamWriter.Close();
    clientStream.Close();
}

c.Stop();
Console.WriteLine("Authentication Time:"  + c.Elapsed.Seconds);

我使用上面的代码来验证与本地计算机上的客户端的SSL连接。我使用安装在本地计算机上的自签名受信任机构创建了证书。平均而言,验证客户端请求大约需要5秒钟。

我不明白为什么这么长时间。但是,对同一资源的后续请求似乎需要0秒。如何提高性能?

0 个答案:

没有答案
相关问题