Error occurs on a .NET client that consumes a Web service through an HTTP proxy server
Article
This article helps you resolve a problem where an error (The underlying connection was closed: The remote name could not be resolved) occurs when you use a .NET client to consume a Web service through an HTTP proxy server.
Original product version: .NET Framework Original KB number: 318140
Symptoms
When you use a .NET client to consume a Web service through an HTTP proxy server, you may receive the following error message:
The underlying connection was closed: The remote name could not be resolved.
Cause
An HTTP proxy server exists between the Web service and the .NET client, and the proper proxy settings have not been configured.
Resolution
To resolve this problem, supply the proper proxy configuration settings to the .NET client.
The following are the default settings in the Machine.config file:
If the default settings do not automatically detect the proxy server settings, set usessystemdefault to false, and then explicitly designate the proxy server. To designate the proxy server explicitly, use either the Machine.config or Web.config file, or specify the server programmatically.
To specify the proxy server, set the Machine.config or Web.config file settings as follows:
Consume a REST web service by using HttpClient and perform basic CRUD operations. You'll detect when your device is connected to the internet to provide a good user experience and take advantage of the native networking stacks to get top performance.