What is the difference between ServiceBehavior and CallbackBehavior in WCF?
and also between contract and a behavior.
What is the difference between ServiceBehavior and CallbackBehavior in WCF?
and also between contract and a behavior.
You can dig into this a bit on MSDN they have a great section on WCF Fundamentals.
A Service Behavior is a type that implements IServiceBehavior and applies to Services.
Basicly it defines how your Service will behave in general, what kind of message and security it will use.
It's similar for Callback Behavior, it defines how the callback on an Operation will behave, see here for WCF Callbacks; a beginners guide.
A contract defines what operations you have and how you use them is defined by the behaviour. Here is an example of a service contract.
The ServiceBehaviour as name implies controls how the service behaves. Taken from MSDN:
Behaviors are types that modify or extend Service or Client functionality. For example, the metadata behavior that ServiceMetadataBehavior implemented controls whether the Service publishes metadata. Similarly, the security behavior controls impersonation and authorization, while the transactions behavior controls enlisting in and auto-completing transactions.
A CallbackBehaviour is an EndpointBehaviour that is used for duplex communication. There is also another behaviour type which is an OperationBehaviour
A contract is the public interface between the client and the service.