Note that there are some explanatory texts on larger screens.

plurals
  1. POC# HTTP Post code causing Worker Process Hang Up
    primarykey
    data
    text
    <p>We have been noticing hanging requests when viewing worker processes in IIS, and we initially thought that specifying an HTTP timeout value would solve the problem, but it didn't. We located the piece of code causing the issue, but we are still unsure what might be causing it.</p> <p>The following piece of code takes in a List of Key/Value pairs and creates a HTTP Post request and puts the values in the POST payload. It works most of the time fine, but not sure what might be causing the problems.</p> <pre><code> public List&lt;KeyValuePair&lt;string, string&gt;&gt; Data { get; set; } public string Invoke() { StringBuilder paramBuilder = new StringBuilder(); for (int i = 0; i &lt; Data.Count; i++) { var d = Data[i]; string delimeter = i &lt; Data.Count - 1 ? "&amp;" : string.Empty; paramBuilder.AppendFormat("{0}={1}{2}", d.Key.Trim(), d.Value != null ? HttpUtility.UrlEncode(d.Value.Trim()) : string.Empty, delimeter); } WebRequest request = WebRequest.Create(Url); request.ContentLength = paramBuilder.Length; request.ContentType = "application/x-www-form-urlencoded"; request.Method = "POST"; Stream rs = request.GetRequestStream(); ASCIIEncoding encoding = new ASCIIEncoding(); var postData = encoding.GetBytes(paramBuilder.ToString()); rs.Write(postData, 0, postData.Length); var response = request.GetResponse(); StreamReader reader = new StreamReader(response.GetResponseStream()); string str = reader.ReadToEnd(); rs.Close(); //JUST ADDED _ MAYBE THESE WERE THE PROBLEM? reader.Close(); //JUST ADDED - MAYBE THESE WERE THE PROBLEM? return str; } </code></pre> <p>Any ideas would be helpful. </p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload