我打電話第三方服務,當我問一個響應它拋出,說驗證失敗,因爲遠程方已關閉正從web服務
「驗證異常的響應時的傳輸流異常因遠程方已關閉傳輸流異常而失敗「。
我認爲在發送憑證時存在問題。我甚至嘗試提供新的憑據。下面是完整的代碼
string get_url = "https://**.*******.com/com/******/webservices/public_webservice.cfc?wsdl&Method=CreateUser&SiteID=**&WSPassword=******&UserName=******";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(get_url);
request.MaximumAutomaticRedirections = 4;
request.MaximumResponseHeadersLength = 4;
request.Credentials = CredentialCache.DefaultCredentials;
//request.UseDefaultCredentials = false;
//request.Credentials = new System.Net.NetworkCredential("*****", "*****");
request.ContentType = "application/x-www-form-urlencoded; charset=ISO-8859-1";
// Show the sent stream
//lbl_send_stream.Text = send_stream;
//lbl_send_stream.Text = get_url;
// Get UserId And LoginToken From Third Party DB
// ==============================================
//Exception gets throwed When code hits here
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
http://stackoverflow.com/questions/19639846/failure-on-httpwebrequest-with-inner-exception-authentication-failed-because-the –
我試過了,它並不能解決問題。 –