WCF CreateChannel for each method call

In my current web project, we execute ClientFactory.CreateChannel for each method call for the remote service.

Is it really necessary? What is the best practice?

+5
source share
2 answers

To some extent, it depends on your requirements. Opening a channel is expensive, relatively speaking. Best practice is for a class that makes remote calls to implement IDisposable, it should make a call to ClientFactory.CreateChannel once, use channels in all method calls and close the channel when calling the Dispose method. However, if the time between calls to methods invoking the remote service is long (longer than the default timeout on the channel, which is 10 minutes), then executing ClientFactory.CreateChannel is not particularly harmful, but I would say anyway it would be better to go along the IDisposable path and encapsulate the use of the class with the keyword "using"

+2
source

"".

Duplex WCF

, .

(, , ).

/ immmediatley, . / .

WCF

, / /, . - - WCF, .

!!!!

0

All Articles