WCF Self-hosted service, client clean-up on service stop
Posted
by Sentax
on Stack Overflow
See other posts from Stack Overflow
or by Sentax
Published on 2009-02-03T22:13:18Z
Indexed on
2010/03/21
16:41 UTC
Read the original article
Hit count: 483
Hi everyone,
I'm curious to know how I would go about setting up my service to stop cleanly on the server the service will be installed on. For example when I have many clients connecting and doing operations every minute and I want to shut-down the service for maintenance, how can I do this in the "OnStop" event of the service to then let the main service host to deny any new client connections and let the current connections finish before it actually shuts down its services to the client, this will ensure data isn't corrupted on the server as the server shuts down.
Right now I'm not setup as a singleton because I need scalability in the service. So I would have to somehow get my service host to do this independently of knowing how many instances are created of the service class.
I hope I explain myself good enough, if not, let me know, I'll try to explain better.
Thanks, Scott
© Stack Overflow or respective owner