我写了一个c#应用程序,将我的数据从Blinksale迁移到Freeagent。这一切都工作正常,我正在适当的各种Web服务调用,但是当我运行一个批处理的进程,它获得第三个发票上的导入和超时。在一个像像Web服务请求第三次点击超时
Stream dataStream = request.GetRequestStream();
现在我已经联系了API提供商(希捷FreeAgent),谁是很好的,他们已经检查了日志,第一2次尝试(其中包括3个人的每一个电话),但没有第三个请求的迹象。这将使得该Web服务的第8次请求成为可能,但在此之前可能会有相当多的代码使用类似的代码来获取数据。
因此,我认为这是与我的.NET代码。
因为有这么多事情发生,所以我很难分享任何片段,但基本上我多次做同样的事情。
N.B.我已经检查,它不是第三个请求中的数据(我跳过它的结果相同)
// Create a request using a URL that can receive a post.
WebRequest request = WebRequest.Create ("http://www.contoso.com/PostAccepter.aspx ");
// Set the Method property of the request to POST.
request.Method = "POST";
// Create POST data and convert it to a byte array.
string postData = "This is a test that posts this string to a Web server.";
byte[] byteArray = Encoding.UTF8.GetBytes (postData);
// Set the ContentType property of the WebRequest.
request.ContentType = "application/x-www-form-urlencoded";
// Set the ContentLength property of the WebRequest.
request.ContentLength = byteArray.Length;
// Get the request stream.
Stream dataStream = request.GetRequestStream();
// Write the data to the request stream.
dataStream.Write (byteArray, 0, byteArray.Length);
// Close the Stream object.
dataStream.Close();
// Get the response.
WebResponse response = request.GetResponse();
// Display the status.
Console.WriteLine (((HttpWebResponse)response).StatusDescription);
// Get the stream containing content returned by the server.
dataStream = response.GetResponseStream();
// Open the stream using a StreamReader for easy access.
StreamReader reader = new StreamReader (dataStream);
// Read the content.
string responseFromServer = reader.ReadToEnd();
// Display the content.
Console.WriteLine (responseFromServer);
// Clean up the streams.
reader.Close();
dataStream.Close();
response.Close();
您是否确认该请求将从您的代码发出?这可能是需要研究的。 – 2010-11-17 17:36:20