我寫了一個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