In WCF, what is the difference between a Behaviour and a Contract? From examining the config file, both seem to point to the interface of the service functionality. Why are they both needed?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The Cole’s Notes version:
The Contract specifies what the service actually does. In other words, what Operations are valid.
The Endpoint specifies an actual running instance of the service. It is the actual “service” in the sense that it executes, either as a Windows Service or under IIS.
The Service Behavior defines how the endpoint interacts with clients. Attributes like security, concurrency, caching, logging, etc. – those are all part of the behavior.
There is also an Operation Behavior which is similar to the Service Behavior but only gets applied when a specific operation is run.
For more information I suggest you start with the WCF Architecture Overview.