At the time of making an interface, part of the requirements according to the user-specified URL, through the post way to send data, the previous debugging, has always been able to send data to get the return value, but then several debugging, in the absence of changes in the code, the result of the GetResponse will always die out.
After the internet Baidu has found the following several reasons and corresponding solutions:
1, modify the DefaultConnectionLimit to a larger value (the system defaults to 2)
System.Net.ServicePointManager.DefaultConnectionLimit = 50;
2. Add a garbage collection before HttpWebRequest req = (HttpWebRequest) webrequest.create (V_strurl)
More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/aspx/
System.GC.Collect ();
3, after each use of HttpWebRequest to close the corresponding HTTP connection
Req. Close ();
Req=null;
The best corresponding HttpWebResponse also want close:
Rep. Close ();
Rep = null;
Detailed code case: Click to open the link
More detailed delay analysis: Click on the Open link