0
我有一個HttpWebRequest
這是工作,並在幾個星期後,它突然停止工作,並開始引發錯誤:底層連接已關閉。 (HttpWebRequest的)
這裏是我的代碼:
The underlying connection was closed: An unexpected error occurred on a send
HttpWebRequest FirstRequest = null;
HttpWebRequest postRequest = null;
HttpWebResponse response = null;
try
{
FirstRequest = (HttpWebRequest)WebRequest.Create("https://my.emerchantpay.com");
FirstRequest.CookieContainer = new CookieContainer();
FirstRequest.CookieContainer = _cookies;
FirstRequest.Accept = @"text/html, application/xhtml+xml, */*";
FirstRequest.Referer = @"https://my.emerchantpay.com";
FirstRequest.Headers.Add("Accept-Language", "en-GB");
FirstRequest.UserAgent = @"Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)";
FirstRequest.Host = @"my.emerchantpay.com";
response = (HttpWebResponse)FirstRequest.GetResponse();//here is error
}catch{}
什麼我做錯了嗎?
使用Fiddler調試這個場景... –
THR網址中包含'https' scheme.Aren't您打算使用任何身份驗證? –