now i try to call web service in local server from windows service but i have error the error is "The request was aborted: The request was canceled." my code is
try {
XmlDocument soapEnvelopeXml = new XmlDocument();
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("xx.asmx");
request.UserAgent = "Mozilla/5.0";
request.Host = "server";
request.ContentType = "text/xml; charset=utf-8";
request.Headers.Add("SOAPAction", "\"xx\"");
request.Method = "POST";
request.Accept = "text/xml";
soapEnvelopeXml.LoadXml(getXml(dt));
request.ContentLength = soapEnvelopeXml.OuterXml.Length;
using (Stream Stream = request.GetRequestStream()) {
soapEnvelopeXml.Save(Stream);
}
using (WebResponse response = request.GetResponse()) {
using (StreamReader rd = new StreamReader(response.GetResponseStream())) {
string soapResalt = rd.ReadToEnd();
CtlCommon.CreateErrorLog(strPath, soapResalt);
}
}
} catch (Exception ex) {
CtlCommon.CreateErrorLog(strPath, ex.InnerException.ToString);
CtlCommon.CreateErrorLog(strPath, ex.Message);
}
some time i try to close Stream, StreamReader and response but the error still exist