When running applications on .NET with Address Finder and Map Image services, the following error is displayed:
"The underlying connection was closed: A connection that was expected to be kept alive was closed by the server."
After the error, the application continues to run; the next message to the server is fine.
The error occurs after services have run a while and sometimes at the start of the application after it was run previously.
The Authentication method getToken is throwing the exception due to a problem with an HTTP proxy server that exists between the Web service and the .NET client.
Enter the proper proxy configuration settings into the .NET client.
See the link to a Microsoft white paper in the Related Information section below for more information and solutions for this problem.
There is also another property, KeepAlive, which can fix this.
Code: webRequest.KeepAlive = false;
See the link for an Alternate solution in the Related Information section below for more information.