1.

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)

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)



Discussion

No Comment Found