Instance management refers to the way a service handles
a request from a client. Instance management is set of techniques WCF uses to
bind client request to service instance, governing which service instance
handles which client request. It is necessary because application will differ
in their need for scalability, performance, durability, transaction and queued
calls.
Basically there are three instance
modes in WCF
Configuration:
Instance mode can be configured using Service Behavior attribute. This can be specified at implementing the service contract as shown below. [Service Contract()]
public interface IMyService
{
[Operation Contract]
int MyMethod();
}
[Service Behavior(InstanceContextMode=InstanceContextMode.Single)]
public class MyService:IMyService
{
public int MyMethod()
{
//Do something
}
}
No comments:
Post a Comment