【发布时间】:2011-02-09 10:08:17
【问题描述】:
这是this question 的后续内容,内容是如何在HttpWebRequest 上打开Connection: Keep-Alive 标头。
我已成功从我的 Web 服务调用中禁用 Connection: Keep-Alive 标头,但是当我使用代理时,它还会在调用发送到服务器之前向代理发送 CONNECT xxx.xxxxx.xx:443 HTTP/1.1。
使用这个CONNECT 调用会发送一堆标头:
System.Net Information: 0 : [5420] ConnectStream#33166512 - Sending headers
{
Proxy-Authorization: Basic xxxxxxxxxxxxxxx==
Host: xxx.xxxxx.xx
Proxy-Connection: Keep-Alive
}.
我想摆脱 Keep-Alive 并将其更改为 Close 但不知道如何控制此标头。如何更改或禁用 Proxy-Connection 标头?
编辑:
谷歌搜索,我发现我必须设置 webRequest.Connection = "Close"; 或 webRequest.Connection = null;,但这些会导致参数异常。
【问题讨论】:
标签: c# web-services session proxy asmx