How do you send a Connection: Close header?
We have a .Net application that runs on a server. It has a reference to a
.Net web service.
We want to force the connection to close because the web service is behind a
load balancer as there are multiple boxes processing this service. Because
my “client” is really an application server that takes requests from 100s of
users we don’t want the automatic reuse of the HTTP connection.
We have tried the following:
System.Net.HttpWebRequest request =
(System.Net.HttpWebRequest)base.GetWebRequest(uri);
request.KeepAlive = false;
That removes the Connection: Keep-Alive header, but does not cause the
connection to be closed.
System.Net.HttpWebRequest request =
(System.Net.HttpWebRequest)base.GetWebRequest(uri);
request.Connection = “Close”;
This throws an exception, it appears you can’t really set this.
We have also tried using a unique ConnectionGroupName for each call, no help.
Any help would be greatly appreciated.
Thanks
Chad
shriop - 22 Aug 2005 04:42 GMT
Offhand, I can't answer your question directly, but are you sure that
you absolutely have to send that header value to get your load balancer
to close the connection? I'm assuming you've noticed an issue, and if
so, have you tried making sure you call Dispose on the HttpWebResponse
object? Also, try specifying this
ServicePointManager.Expect100Continue = false;
Bruce Dunwiddie
http://www.csvreader.com