Vivin joy
Vivin joy

Reputation: 97

Is it a better approach to close and re-open the WCF proxy , when we are re-using it?

I am implementing an object pool for my WCF proxy. Once a proxy has been used, is it better if we close it down, kind of passivating it, so that its active connections are closed. When the proxy object is borrowed, we could re-open the proxy(activating) just before passing it. Will this approach have a performance hit?

Upvotes: 0

Views: 667

Answers (1)

Chris Dickson
Chris Dickson

Reputation: 12135

You can't "re-open" a closed proxy. A proxy implements ICommunicationObject and conforms to the standard state machine for communication objects in WCF. There is no transition from the Closed state back to the Open state.

If you decide to implement a pool for your proxies, they must remain in the Open state, or be discarded from the pool.

Upvotes: 2

Related Questions