locked
close a session from service side RRS feed

  • Question

  • Hi: I have a WCF service using wshttpbinding, when the service return a fault, I want also close the session with the client so other client can use the slot. Thanks
    Sunday, October 28, 2012 8:39 AM

Answers

  • Hi zhanghb0001,

    As far as I know, all of the exceptions( include the derived classes of FaultException) will terminate session by default, regardless which session binding is used. WCF will release the instance, the client will get a FaultException exception. Once session involved service instance has encountered an error, the session cannot be used any more.

    If you want to terminate the session after calling the operation, you can do this by setting IsTerminating(False by default) property of the operation to True.

    Best Regards.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Edited by Haixia_Xie Monday, October 29, 2012 6:59 AM
    • Marked as answer by Haixia_Xie Tuesday, November 6, 2012 4:42 AM
    Monday, October 29, 2012 6:58 AM

All replies

  • Hi zhanghb0001,

    As far as I know, all of the exceptions( include the derived classes of FaultException) will terminate session by default, regardless which session binding is used. WCF will release the instance, the client will get a FaultException exception. Once session involved service instance has encountered an error, the session cannot be used any more.

    If you want to terminate the session after calling the operation, you can do this by setting IsTerminating(False by default) property of the operation to True.

    Best Regards.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Edited by Haixia_Xie Monday, October 29, 2012 6:59 AM
    • Marked as answer by Haixia_Xie Tuesday, November 6, 2012 4:42 AM
    Monday, October 29, 2012 6:58 AM
  • Hi Haixia:

        After do more test, I found

    1. If I throw FaultException from service, the client's state won't transfer to faultd

    2. If I throw normal exception from service, the client will be in fault state.

    3. If the client in Faulted state, even I call client's abort, the service's instance will not be disposed

    Thanks

    Wednesday, October 31, 2012 4:15 PM
  • When the service session involved instance encounter with an error, the only safe behavior client can do is closing the proxy.
    Friday, November 2, 2012 1:44 AM