System.Net.WebClient The underlying connection was closed

itaznalym

New Member
The underlying connection was closed: The connection was closed unexpectedlyI'm receiving the error message when using WebClient. I had tested this with asp code and it is running pretty well. But when I try to run the exe version of the code it running the following error, and I able to access the request address from the server, and it is within the internal network.My server setup :-Windows Server 2003 Entrerprise SP2asp.net 2.0.50727iis v6.0Here is some code:Manually accessing the \[code\]protected static String cross_server_req(String strContent, String strPage, String strPrivateKey) { try { WebClient wc = new WebClient(); String strURL = SERVICE_PATH + strPage + "?r=" + DES_.DESEncrypt(strContent); byte[] responseArray = wc.DownloadData(strURL); String strResData = http://stackoverflow.com/questions/15654799/Encoding.UTF8.GetString(responseArray); if (Config.RecordWebService =="1") { String strLogContent = "Request:" + strContent + "\r\nResponse:" + strResData + "\r\nDateCreated:" + D_Time.DNow + "\r\n\r\n"; ServiceLog.Logger(strPage, strLogContent); } if (null != strResData && String.Empty != strResData) { return strResData.Trim(); } } catch (Exception ex) { ServiceLog.Logger("cross_server_req() Exception:" + ex.Message + "\r\n" + ex.StackTrace); } return null; }\[/code\]Here is from log\[code\]cross_server_req() Exception:The underlying connection was closed: The connection was closed unexpectedly.at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)at System.Net.WebClient.DownloadData(Uri address)at System.Net.WebClient.DownloadData(String address)at Account.cross_server_request_curl(String strContent, String strPage, String strPrivateKey)\[/code\]Please let me know any suggestion help this problem? I had look around the site and no solution had found.
 
Back
Top