c# - Long running, but finite length HttpWebRequest Callout gets only partial data -


I am trying to work with a third party service API, one of the ways in which all records Those that take a lot of time, about 9 minutes (I tried to use this Chrome app "Advanced Rest Client").

I have webRequest.Timeout = 3600000; Have tried setting timeout // // timeout. Infinity; but it always comes back after 2 minutes and the result is 135 records (while the Chrome app returns 1050 records, which is correct #)

I have the same parameters in both cases (I send it as POST data); So why is the difference in the result? I am using this code in the class library which will be used in a WPF application.

  1. What is the maximum value for timeout?
  2. Timeout. Eternal is setting it '-1', is that right?
  3. What are other ways to get all the data?

Any help / suggestion is greatly appreciated.

Update: Adding code

  HTTP Webbet WebRequest = (HTTP WebBurst) http webbet. Create (url); AllDevicesList devInfo = null; {String postData = ""; Foreign currency (string key in postParameters.Keys) {postData + = HttpUtility.UrlEncode (key) + "=" + HttpUtility.UrlEncode (Postpameters [key]) + "& amp;"; } PostData = postData.TrimEnd ('& amp;'); If (cookie == blank) webRequest.CookieContainer = new cookie attendant (); Other webRequest.CookieContainer = Cookie; WebRequest.Timeout = 3600000; // timeout Infinite; // 1000000; WebRequest.KeepAlive = True; WebRequest.method = "post"; Byte [] Data = Encoding. ASCII.GetBytes (PostData); WebRequest.ContentType = "app / x-www-form-url expired"; WebRequest.ContentLength = data.Length; Stream request stream = webRequest.GetRequestStream (); RequestStream.Write (data, 0, data. Lang); WebResponse WebResp = webRequest.GetResponse (); DataContractJsonSerializer jsonSerializer = New DataContractJsonSerializer (TypeDevicesList); Object objResponse = jsonSerializer.ReadObject (WebResp.GetResponsestream ()); AllDevicesList as DevInfo = objResponse; RequestStream.Close (); WebResp.Close (); I have changed the implementation to asynchronous and now I get all the records. Thanks for all your responses. 


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -