1

I'm trying to disable HTTP keep-alive, and I can't seem to find any documentation on how to achieve that. Ultimately, I am occasionally getting:

System.ServiceModel.CommunicationException: The underlying connection was closed: A connection that was expected to be kept alive was closed by the server

I've heard the best approach is simply to disable HTTP keep-alive.

SliverNinja - MSFT
  • 31,051
  • 11
  • 110
  • 173
Grant H.
  • 3,689
  • 2
  • 35
  • 53

1 Answers1

1

Ultimately I solved my own issue here with a little helper function that takes my basicHttpRelayBinding and modifies it appropriately:

private static System.ServiceModel.Channels.Binding GetBinding(System.ServiceModel.Channels.Binding bIn)
    {
        var bOut = new CustomBinding(bIn);
        var transportElement = bOut.Elements
              .Find<HttpsRelayTransportBindingElement>();
        transportElement.KeepAliveEnabled = false;
        return bOut;
    }
Grant H.
  • 3,689
  • 2
  • 35
  • 53