none
WCF Service is Channel is Faulted RRS feed

  • Question

  • Hi all, 
    I am supporting a production environment, and now i could see in logs that a "Channel state is faulted in CloseChannel". What to do in such a scenario, as communication is stopped between application layers. How to close / abort and reestablish the connection. Also i may not be able to apply any patches or code changes. One more thing to convey , we are using Load Balancer between the Servers.
    Thursday, August 7, 2014 11:48 AM

Answers

  • Hi,

    When an ICommunicationObject (your WCF client object) is in a faulted state, then maybe you need to re-open it, the only way to "re-open" it is to create a new one as following:

    ServiceClient client = new ServiceClient();
    try
    {
        client.Operation1();
    }
    catch(Exception ex)
    {
        if (client.State == CommunicationState.Faulted)
        {
                client.Abort();
                client = new ServiceClient();
        }
    }
    try
    {
        client.Operation2();
    }
    catch(Exception ex)
    {
       // Handle Exception
    }
    

    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.

    Friday, August 8, 2014 6:03 AM
    Moderator