C# first time I use GetRequestStream() it takes 20 seconds -


I use C #.

The first time I use WebRequest GetRequestStream () in my code, after 20 seconds it takes less than 1 second.

Below is my code line "this.requestStream = httpRequest.GetRequestStream ()" is causing the delay.

  StringBinder PostData = New StringBuilder (100); PostData.Append ("param ="); PostData.Append ("test"); Byte [] Data array = encoding. UTF8.GetBytes (postData.ToString ()); This.httpRequest = (HttpWebRequest) WebRequest.Create ("http://myurl.com"); HttpRequest.method = "POST"; HttpRequest.ContentType = "application / x-www-form-urlencoded"; HttpRequest.ContentLength = dataArray.Length; This.requestStream = httpRequest.GetRequestStream (); (Request array) stream.Write (data array, 0, data array) using request; This.webResponse = (HttpWebResponse) httpRequest.GetResponse (); Stream response stream = webResponse.GetResponseStream (); StreamerRedderRedder = New System.io.StreamRadder (Reactions Stream, Encoding.Utf 8); String response string = response reader. Readout ();  

How can I see what is the reason for this? (For example: DNS lookup? Server is not responding?)

Thanks and Connection, Kon

.Proxy = null Sometimes it tries to automate a proxy that takes time, which takes time.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -