Saturday, September 7, 2019

What is Instancing modes in WCF?

We will discuss, different instancing modes available in WCF. Instancing modes are also called as instance context modes.

Instance context mode dictates, how long the service instance remains on the server.
Instance context modes in wcf

There are 3 instancing modes 
1. PerCall - A new instance of service object is created for every request, irrespective of whether the request comes from the same client or a different client.

2. PerSession - A new instance of the service object is created for each new client session and maintained for the duration of that session.

3. Single - A single instance of the service object is created and handles all requests for the lifetime of the application, irrespective of whether the request comes from the same client or a different client.

How do you specify what instancing mode you want to use?
Use ServiceBehavior attribute and specify InstanceContextMode.
instancing modes in wcf


No comments:

Post a Comment

Get max value for identity column without a table scan

  You can use   IDENT_CURRENT   to look up the last identity value to be inserted, e.g. IDENT_CURRENT( 'MyTable' ) However, be caut...