Questions tagged [servicepoint]

The .NET ServicePoint class is used to implement web service end-points.

33 questions
32
votes
1 answer

System.Net.ServicePointManager.DefaultConnectionLimit and .MaxServicePointIdleTime

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…
BuddyJoe
  • 69,735
  • 114
  • 291
  • 466
28
votes
3 answers

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

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…
Sam Saffron
  • 128,308
  • 78
  • 326
  • 506
12
votes
3 answers

HttpWebResponse won't scale for concurrent outbound requests

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…
erasend
  • 123
  • 1
  • 4
10
votes
1 answer

Avoiding a ProtocolViolationException following a WebException

I'm working on resolving this bug: https://github.com/openstacknetsdk/openstack.net/issues/333 The issue involves a ProtocolViolationException with the following message: Chunked encoding upload is not supported on the HTTP/1.0 protocol. I found…
Sam Harwell
  • 97,721
  • 20
  • 209
  • 280
8
votes
3 answers

Inspect server certificate using HttpClient

I'm rewriting some web handling code in WinForms and switching from HttpWebRequest to HttpClient. There's one last thing I require that I cannot seem to find out how to accomplish. In HttpWebRequest, I can capture the certificate from the web server…
LordChariot
  • 543
  • 1
  • 6
  • 10
7
votes
1 answer

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

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…
Dreamer
  • 3,371
  • 2
  • 34
  • 50
6
votes
3 answers

How should I use the HttpClient in an ASP.NET Core 2.0 API

I am working on an ASP.NET Core 2.0 API and my API needs to make calls to another, 3rd party, REST API to upload and retrieve files and get file lists and status information. I will be hosting the API in Azure and plan to do Blue-Green deployments…
5
votes
0 answers

The correct way to permanently set properties on a ServicePoint

I would like to turn off Nagle algorithm on a specific connection (in my case - to an ElasticSearch server). My code currently looks something like this: ServicePointManager.FindServicePoint(new Uri(uriWithoutLocalPath)).UseNagleAlgorithm =…
Doron Yaacoby
  • 9,412
  • 8
  • 48
  • 59
4
votes
1 answer

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

We are using HttpClient to send requests to remote Web API in parallel: public async Task PostAsync(HttpRequestInfo httpRequestInfo) { using (var httpClient = new HttpClient()) { httpClient.BaseAddress = new…
Jerry Bian
  • 3,998
  • 6
  • 29
  • 54
4
votes
1 answer

Using BindIPEndPointDelegate to specify the source port doesn't seem to work

I've searched all over on how to use BindIPEndPointDelegate to change the source port of my HttpWebRequest. I have found multiple posts on this: Here and Here However, It doesn't seem to be working for me. I found the same issue with this…
3
votes
1 answer

ServicePointManager Monitoring HTTP Requests

I am working with an application that sends hundreds of HTTP requests a minute to different URIs. Is there any way to monitor the connections the application has created? I found that the ServicePointManager is great for inspecting a particular…
cgatian
  • 22,047
  • 9
  • 56
  • 76
3
votes
1 answer

ServicePointManager.DefaultConnectionLimit scope

Does changing ServicePointManager.DefaultConnectionLimit affect only the current process or the whole .NET platform. Please provide source.
RSuthke
  • 433
  • 1
  • 5
  • 9
3
votes
0 answers

Best HttpClient / ServicePointManager settings for performance?

I'm using HttpClient to make batches of request to a number of servers. There may be a number of batches in progress at any given time. I use one Httpclient per batch which will all go to the same server. So if I have 3 jobs in flight to 3 servers…
Dan
  • 59
  • 1
  • 6
2
votes
1 answer

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."?

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…
mcdrewski
  • 688
  • 7
  • 15
2
votes
0 answers

Binding web requests to specific network adapter

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…
1
2 3