How do you send a Connection: Close header?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ChadH

    #1

    How do you send a Connection: Close header?

    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.Http WebRequest request =
    (System.Net.Htt pWebRequest)bas e.GetWebRequest (uri);
    request.KeepAli ve = false;

    That removes the Connection: Keep-Alive header, but does not cause the
    connection to be closed.

    System.Net.Http WebRequest request =
    (System.Net.Htt pWebRequest)bas e.GetWebRequest (uri);
    request.Connect ion = “Close”;

    This throws an exception, it appears you can’t really set this.

    We have also tried using a unique ConnectionGroup Name for each call, no help.

    Any help would be greatly appreciated.

    Thanks

    Chad

  • shriop

    #2
    Re: How do you send a Connection: Close header?

    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

    ServicePointMan ager.Expect100C ontinue = false;

    Bruce Dunwiddie
    Read, write, and bulk insert common file formats like CSV, Excel, and XML from C# and VB.Net.


    Comment

    Working...