none
WCF set keepAliveEnable=“false” not working RRS feed

  • Question

  • In my service I need to set keepAliveEnable=false in order to work with my load balancer. Therefore I followed instruction in this article. I did same thing mentioned in article but I am getting this error.

    <customBinding>
       <binding name="HttpBinding" keepAliveEnabled="False"/>
    </customBinding>
    
    The Scheme cannot be computed for this binding because this CustomBinding lacks a TransportBindingElement.  Every binding must have at least one binding element that derives from TransportBindingElement.

    Then I found set keepAliveFalse like below

    <customBinding>
        <binding name="HttpBinding" >
          <textMessageEncoding />
          <httpTransport  allowCookies="false"  keepAliveEnabled="false"/>
        </binding>
      </customBinding>

    In this method service is getting started normal and I can get the responses. But in request headers still shows connection as keep alive. (I checked using firebug) enter image description here

    1. What is the correct way of doing this?
    2. What is the end I need to set keep alive false (client or service) ?
    3. Am I checking keepAlive in wrong way?

    chapneox

    Friday, October 31, 2014 4:31 AM

Answers

  • Hi chapneox,

    I have used the following config file, it works well in my side:

    <bindings>
        <customBinding>
           <binding name="CustomBinding" closeTimeout="00:00:45">
                <textMessageEncoding/>
                <httpTransport 
                  allowCookies="false"
                  keepAliveEnabled="false" />
            </binding>
        </customBinding>
    </bindings>
    <services>
        <service name="YourService" behaviorConfiguration="YourServiceBehavior">
        <endpoint address="http://localhost:4050/..."
              binding="customBinding"
              bindingConfiguration="CustomBinding"
              contract="IYourService"
              behaviorConfiguration="..........."/>
        </service>
    </services>

    First please try to make sure that you have applied the customBinding Configuration to the endpoint. Then could you please try to tell us if you are using the customBinding in your client side?

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.





    Monday, November 3, 2014 6:22 AM
    Moderator