Service Proxy and Sessions
The service proxy has special behaviors for session and non-session-based channel bindings. The service proxy provides session based semantics if the underlying channel binding is session based. In this case a single channel is used to service calls. However, if the channel binding is not session based, the service proxy creates a separate channel for each call. Note, though, that non-session-based channels are pooled and maybe reused. In reusing a channel, the service proxy keeps the channel open if the underlying channel has not faulted or the call on a channel has resulted in the service proxy's faulting the channel. Note that. except in the event of a fault, once a channel is opened it is kept open as long as the service proxy is open and is closed only when the service proxy is closed.
If the channel binding is session based and if the underlying channel faults, the service proxy state machine will transition into the WS_SERVICE_PROXY_STATE_FAULTED state. In the case of non-session based channel binding, a fault in the underlying channel does not cause the proxy to transition into WS_SERVICE_PROXY_STATE_FAULTED state.
For more information on the service proxy and its relation to state, see the Service Proxy topic. For examples of different channel bindings see the following examples:
- non-session channel binding, HttpCalculatorClientExample
- session-based channel binding, SessionfullCalculatorClientExample