Question

I want to Dispose of some objects that are created during a WCF service method, but I need to clean them up outside of the scope of the method that created them. When I'm working in ASP.NET, I normally call that code during the Application_EndRequest event.

If the answer is: there is no Application_EndRequest-like event in WCF, how should I go about cleaning up my objects?

Était-ce utile?

La solution

You can implement IDisposable for your WCF service. If the service is configured PerSession or PerCall *context mode* dispose method will be called once the channel is closed and the service instance is dropped.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top