Skip to Content
Programming WCF Services, 2nd Edition
book

Programming WCF Services, 2nd Edition

by Juval Lowy
November 2008
Intermediate to advanced
784 pages
23h 28m
English
O'Reilly Media, Inc.
Content preview from Programming WCF Services, 2nd Edition

Per-Call Services

When the service type is configured for per-call activation, a service instance (the CLR object) exists only while a client call is in progress. Every client request (that is, a method call on the WCF contract) gets a new dedicated service instance. The following list details how per-call activation works, and the steps are illustrated in Figure 4-1:

  1. The client calls the proxy and the proxy forwards the call to the service.

  2. WCF creates a service instance and calls the method on it.

  3. When the method call returns, if the object implements IDisposable, WCF calls IDisposable.Dispose( ) on it.

  4. The client calls the proxy and the proxy forwards the call to the service.

  5. WCF creates an object and calls the method on it.

Per-call instantiation mode

Figure 4-1. Per-call instantiation mode

Disposing of the service instance is an interesting point. As I just mentioned, if the service supports the IDisposable interface, WCF will automatically call the Dispose( ) method, allowing the service to perform any required cleanup. Note that Dispose( ) is called on the same thread that dispatched the original method call, and that Dispose( ) has an operation context (presented later). Once Dispose( ) is called, WCF disconnects the instance from the rest of the WCF infrastructure, making it a candidate for garbage collection.

Benefits of Per-Call Services

In the classic client/server programming model, using languages such ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming WCF Services

Programming WCF Services

Juval Lowy

Publisher Resources

ISBN: 9780596157210Supplemental ContentErrata