Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 每个请求都是一次完整的ssl握手,如何重用ssl会话?_C#_.net_Ssl_Https_Session Reuse - Fatal编程技术网

C# 每个请求都是一次完整的ssl握手,如何重用ssl会话?

C# 每个请求都是一次完整的ssl握手,如何重用ssl会话?,c#,.net,ssl,https,session-reuse,C#,.net,Ssl,Https,Session Reuse,.NET Framework 4.x 我有一个带有c#的HTTP客户端,我发现HTTPS请求总是完全握手。但是如果使用Postman请求,它将逐个会话重用SSL会话 这些是通过wireshark捕获的数据包: client hello Extension:session_ticket(len=0) sever hello Extension:session_ticket(len=0) New Session Ticket Handshake Protocol:

.NET Framework 4.x

我有一个带有c#的HTTP客户端,我发现
HTTPS
请求总是完全握手。但是如果使用Postman请求,它将逐个会话重用SSL会话

这些是通过wireshark捕获的数据包:

client hello
      Extension:session_ticket(len=0)
sever hello
      Extension:session_ticket(len=0)
New Session Ticket
      Handshake Protocol: New Session Ticket
    Handshake Type: New Session Ticket (4)
    Length: 214
    TLS Session Ticket
        Session Ticket Lifetime Hint: 100800 seconds (1 day, 4 hours)
        Session Ticket Length: 208
        Session Ticket: 50bb2ffffb6ba4e17cdb6d4c6239f8decd2d590d97b01db4…
每个请求包都与上面相同

如果使用邮递员请求

client hello
          Extension:session_ticket(len=208)
有人知道吗

这是我的HTTP客户端

ServicePointManager.ServerCertificateValidationCallback = validationCallback;
if (strUrl.StartsWith("https"))
{
    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;// | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;
}

HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(strUrl);
httpWebRequest.CachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.CacheIfAvailable);
httpWebRequest.Method = "POST";
httpWebRequest.ContentType = "application/octet-stream";
httpWebRequest.Timeout = 30000; ///10s
httpWebRequest.ReadWriteTimeout = 30000; ///10s
httpWebRequest.KeepAlive = false;
httpWebRequest.ContentLength = bytes.Length;
httpWebRequest.Headers.Add("CustomKey", ident.ToString());
httpWebRequest.BeginGetRequestStream(new AsyncCallback(WriteCallback), new RequestState(httpWebRequest, bytes));