servicepoint

Why do dotnet keepalive Http connections fail on the second request with “A connection that was expected to be kept alive was closed by the server.”?

♀尐吖头ヾ 提交于 2021-02-11 14:41:29
问题 I have a dotnet framework application which performs POST api requests to a remote server running Apache. It intermittently fails with the error: The underlying connection was closed: A connection that was expected to be kept alive was closed by the server. This occurs on the second request to the server when done over a keepalive TLS connection, and so occurs more frequently in production systems under heavy load and less frequently or not at all in development environments. We have tried:

webrequests with Binding different IPs using BindIPEndPointDelegate does not result in multiple ServicePoints for same host in multi-thread

此生再无相见时 提交于 2019-12-24 00:54:34
问题 Category: Throughput Increment Scenario: Multiple HttpWebRequests need to be send through different ethernet adapters to the same host. Keys to Remember: Requests are going to same host. There is a built in limit on per-host basis as servicepoint. Number of simultaneous requests to a host can be leveraged by setting System.Net.ServicePointManager.DefaultConnectionLimit to 100 (for example), or by setting webRequest.ServicePoint.ConnectionLimit = 50 (say) for a webrequest objects with same uri

Why System.Net.ServicePoint.ConnectionLimit uses '7FFFFFFF' (Int32.MaxValue/2147483647) when a client connects to a service on 'localhost'?

元气小坏坏 提交于 2019-12-22 05:26:05
问题 Why System.Net.ServicePoint.ConnectionLimit uses '7FFFFFFF' (Int32.MaxValue/2147483647) when a client connects to a service on 'localhost' , whereas it decide to use '2' as default if the service is running on remote machine? Initially I thought it will be ServicePointManager.DefaultConnectionLimit if servicepoint.connectionlimit is not set. However, I just realized (once I got an issue from customer), that its Int32.MaxValue/2147483647. I have done some research (for details please refer to

HttpWebResponse won't scale for concurrent outbound requests

蹲街弑〆低调 提交于 2019-12-20 10:37:19
问题 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

Binding web requests to specific network adapter

…衆ロ難τιáo~ 提交于 2019-12-13 01:26:18
问题 Background I have a mobile embedded device (Ubuntu/Mono) with 2 network adapters. One is WiFi and the other is GSM. The requirement is that when the WiFi adapter is connected to the internet (within range of a predetermined AP), the application uploads data ( HTTPS POST ) via WiFi but when WiFi is not available, but GSM is, it uploads data via GSM link. Testing In order to achieve this, I created a cloud-based webservice that returns OK if you issue a HTTP GET to it. The idea is to have a

ServicePoint,HttpConnectionHttp 1.1,httppipelining, Responons,stream.close internals?

痴心易碎 提交于 2019-12-11 08:35:46
问题 In .net framework 3.5 , http 1.1 i.e persistent connections is used and pipelining is enabled bydefault. Could you please let me know it is neccessary to close stream or connection by calling httpresponse.close or stream.close method to release a connection for another http request to the same internet resourece ? My understanding is even if httpresponse.close or stream.close is not called then too httpconnection i.e. servicepoint should be able to server another concurrent request. Please

Big size of ServicePoint object after several hours sending HTTP request in parallel

心不动则不痛 提交于 2019-12-06 05:59:19
问题 We are using HttpClient to send requests to remote Web API in parallel: public async Task<HttpResponseMessage> PostAsync(HttpRequestInfo httpRequestInfo) { using (var httpClient = new HttpClient()) { httpClient.BaseAddress = new Uri(httpRequestInfo.BaseUrl); if (httpRequestInfo.RequestHeaders.Any()) { foreach (var requestHeader in httpRequestInfo.RequestHeaders) { httpClient.DefaultRequestHeaders.Add(requestHeader.Key, requestHeader.Value); } } return await httpClient.PostAsync

Why System.Net.ServicePoint.ConnectionLimit uses '7FFFFFFF' (Int32.MaxValue/2147483647) when a client connects to a service on 'localhost'?

亡梦爱人 提交于 2019-12-05 07:48:36
Why System.Net.ServicePoint.ConnectionLimit uses '7FFFFFFF' (Int32.MaxValue/2147483647) when a client connects to a service on 'localhost' , whereas it decide to use '2' as default if the service is running on remote machine? Initially I thought it will be ServicePointManager.DefaultConnectionLimit if servicepoint.connectionlimit is not set. However, I just realized (once I got an issue from customer), that its Int32.MaxValue/2147483647. I have done some research (for details please refer to below links), however I couldn't find out why it uses to int32.maxvalue. I can kind of conjecture its

Big size of ServicePoint object after several hours sending HTTP request in parallel

无人久伴 提交于 2019-12-04 09:47:37
We are using HttpClient to send requests to remote Web API in parallel: public async Task<HttpResponseMessage> PostAsync(HttpRequestInfo httpRequestInfo) { using (var httpClient = new HttpClient()) { httpClient.BaseAddress = new Uri(httpRequestInfo.BaseUrl); if (httpRequestInfo.RequestHeaders.Any()) { foreach (var requestHeader in httpRequestInfo.RequestHeaders) { httpClient.DefaultRequestHeaders.Add(requestHeader.Key, requestHeader.Value); } } return await httpClient.PostAsync(httpRequestInfo.RequestUrl, httpRequestInfo.RequestBody); } } This API can be called by several threads concurrently.

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

一个人想着一个人 提交于 2019-12-03 03:41:50
问题 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 =