I am reading a lot of conflicting information about how and when to close a WCF service.
Some people say you don't need to.
Some people say in the same place where you make the Async call
Some people say in the completed method.
Can someone point me to a place where microsoft actually says how to use this method? Also when do you call it?
Are you referring to client or service side closing For client closing this is the recommended pattern - http://blogs.msdn.com/b/drnick/archive/2007/05/04/the-try-catch-abort-pattern.aspx
For services you can close the service host. For eg. in the self hosted service say using a windows NT Service, on Service shutdown you want to close the host so that clean up like un-registering ports etc. happen gracefully.
If you want to the try/catch/abort patten works for invocation and also for close. So you can provide a timeout and if you get a timeout exception, abort the instance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With