Instance Management

  1. Prefer the per-call instance mode when scalability is a concern.

  2. If setting SessionMode.NotAllowed on the contract, always configure the service instancing mode as InstanceContextMode.PerCall.

  3. Do not mix sessionful contracts and sessionless contracts in the same service.

  4. Avoid a singleton unless you have a natural singleton.

  5. Use ordered delivery with a sessionful service.

  6. Avoid instance deactivation with a sessionful service.

  7. Avoid demarcating operations.

  8. With durable services, always designate a completing operation.

Get Programming WCF Services, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.