単純なxmlWebリクエストを送信するコードがいくつかあります。これは、Windowsサービスから呼び出されます。サービスが例外のスローを開始し(System.Net.WebException:操作がタイムアウトしました)、サービスを再起動すると問題が修正される場合があります。コードは次のとおりです。
public bool PerformXmlRequest(string xml)
{
var httpRequest = (HttpWebRequest)WebRequest.Create(_url);
httpRequest.Method = "POST";
httpRequest.ContentType = "text/xml";
using (var xmlWriter = new StreamWriter(httpRequest.GetRequestStream(), Encoding.UTF8))
{
xmlWriter.WriteLine(xml);
}
using (var httpResponse = (HttpWebResponse)httpRequest.GetResponse())
{
return httpResponse.StatusDescription == "OK";
}
}
この問題を引き起こしている可能性のある、明らかに問題があるものはありますか?