wcfservicebehavior

Why is a ServiceBehavior an attribute of the Service Class and not the Contract?


I've found plenty of places where people point out that a ServiceBehavior should be an attribute of the service class and not the contract, and this definitely seems to be the case. Why is this?


Solution

  • Because it deals with implementation detail of the service and is not part of the contract.

    Behaviours such as session, re-entry,... all deal with the implementation so that you could have the same contract (interface) but different implementations exposed at different endpoints.