servicepoint

How can I perform a GET request without downloading the content?

核能气质少年 提交于 2019-12-02 17:08:49
I am working on a link checker, in general I can perform HEAD requests, however some sites seem to disable this verb, so on failure I need to also perform a GET request (to double check the link is really dead) I use the following code as my link tester: public class ValidateResult { public HttpStatusCode? StatusCode { get; set; } public Uri RedirectResult { get; set; } public WebExceptionStatus? WebExceptionStatus { get; set; } } public ValidateResult Validate(Uri uri, bool useHeadMethod = true, bool enableKeepAlive = false, int timeoutSeconds = 30) { ValidateResult result = new

System.Net.ServicePointManager.DefaultConnectionLimit and .MaxServicePointIdleTime

被刻印的时光 ゝ 提交于 2019-11-29 02:57:49
When would you need to adjust these two settings (below)? And what do these two numbers mean for HttpWebRequest instances that I make? System.Net.ServicePointManager.DefaultConnectionLimit System.Net.ServicePointManager.MaxServicePointIdleTime Are ServicePoint objects specific to a domain name or each unique URI requested? Here is a great explanation: Understanding MaxServicePointIdleTime and DefaultConnectionLimit 来源: https://stackoverflow.com/questions/3363183/system-net-servicepointmanager-defaultconnectionlimit-and-maxservicepointidleti

HttpWebResponse won't scale for concurrent outbound requests

∥☆過路亽.° 提交于 2019-11-28 23:34:23
I have an ASP.NET 3.5 server application written in C#. It makes outbound requests to a REST API using HttpWebRequest and HttpWebResponse. I have setup a test application to send these requests on separate threads (to vaguely mimic concurrency against the server). Please note this is more of a Mono/Environment question than a code question; so please keep in mind that the code below is not verbatim; just a cut/paste of the functional bits. Here is some pseudo-code: // threaded client piece int numThreads = 1; ManualResetEvent doneEvent; using (doneEvent = new ManualResetEvent(false)) { for

System.Net.ServicePointManager.DefaultConnectionLimit and .MaxServicePointIdleTime

﹥>﹥吖頭↗ 提交于 2019-11-27 17:13:30
问题 When would you need to adjust these two settings (below)? And what do these two numbers mean for HttpWebRequest instances that I make? System.Net.ServicePointManager.DefaultConnectionLimit System.Net.ServicePointManager.MaxServicePointIdleTime Are ServicePoint objects specific to a domain name or each unique URI requested? 回答1: Here is a great explanation: Understanding MaxServicePointIdleTime and DefaultConnectionLimit 来源: https://stackoverflow.com/questions/3363183/system-net