Question - What is the use of ServiceBehavior attribute in WCF ?
Answer -
ServiceBehaviour attribute is used to specify the InstanceContextMode for the WCF Service class (This can be used to maintained a state of
the service or a client too)
There are three instance Context Mode in the WFC
PerSession : This is used to create a new instance for a service and the same instance is used for all method for a particular client. (eg:
State can be maintained per session by declaring a variable)
PerCall : This is used to create a new instance for every call from the client whether same client or different. (eg: No state can be
maintained as every time a new instance of the service is created)
Single : This is used to create only one instance of the service and the same instance is used for all the client request. (eg: Global state
can be maintained but this will be applicable for all clients)