Hello Everyone.

I have fixed this issue (at least my version) and wanted to share what I found. I am posting this because in my searching neither of this resolutions were mentioned.

My issue was that when I moved my WebService from development to a production server I immediately got the "Connection Closed" errors. I should tell you that my production servers are 2 IIS servers in a dmz behind 2 ISA servers performing Load Balancing.

Changing to HTTP 1.0 and using Keep-Alives got pased the "Connection Closed" issues but then I would get 401 Authorization errors. I thenadded my own Basic Authentication header to the webRequest which finally worked. I didn't like this solution because my I wanted use NTLM.

What stumped me was that IE could connect to the WebService and display it's WSDL using NTLM authentication. I decided to use WireShark to see what is the between .Net and IE. The 2 basic differences I found is that IE supplies a User-Agent and Accepts cookies. .Net Webservices for some reason don't do either of these. So I added them to the WebRequest and voila!

Hopefully this helps anyone else experiecing similiar problems. To use this code open your Reference.cs file under your Web Service reference and paste the function below into your webservice class. Please note you will have to replace the function if you refresh your WebService reference

Mike McCarthy

protected override System.Net.WebRequest GetWebRequest(Uri uri)
{

	System.Net.HttpWebRequest webRequest = (System.Net.HttpWebRequest)base.GetWebRequest(uri);

	// ISA (and probably other servers) will close a connection if they don't
	// know what the user agent is so default to Mozilla
	if (webRequest.UserAgent == null)
	{
		webRequest.UserAgent = "Mozilla/4.0 (compatible;)";
	}


	// ISA server uses a cookie (ISAWPLB) for load balancing but other servers might send cookies too
	//  If a cookiecontainer is not there the request will fail(connection closed)

	//From ISA Server 2006 - Lab manual:
	//	The same Web server handles the Web request. For the second and the subsequent 
	//  requests, the client includes the session cookie (starting with ISAWPLB), which 
	//  it received in the response of the first request. The cookie text contains a 
	//  Global Unique Identifier (GUID) that ISA Server uses to identify which Web server 
	//  it should send the Web request to. This ensures the session affinity with the same
	//  Web server. (ISAWPLB stands for ISA Web Publishing Load Balancing.)
	// Note: In the response, ISA Server also forwards an ASP Session cookie from the 
	//  Web server to the client computer
	if (webRequest.CookieContainer == null)
	{
		webRequest.CookieContainer = new System.Net.CookieContainer();
	}


	// Last Ditch if nothing else works!
	// Turn off keep-alives and change protocol to http 1.0 which
	// doesn't support keep-alive connections
	// This incurs a negligible performance hit
	//if (false)
	//{
	//	webRequest.ProtocolVersion = System.Net.HttpVersion.Version10;
	//	webRequest.KeepAlive = false;
	//}


	return webRequest;

}