Brian Choi535947

Hi all.

I have WCF hosted in windows service.

If I try to close in "OnStop" of servicebase class it will forcefully kill threads running services.

Typically servicehost.close() for my application will take few minutes.

I believe SCM (Service Control Manager) will interrupt servicehost.close() if it is taking too long.

My questions are

1. Is there anyway I can access servicehost directly so that I can just call close() which will graciously wait for all threads to complete (Increasing timeout for SCM is good way )

2. OnPuase or OnCustomCommand will act differently

3. I can get servicehost from service instance using "operationContext" but if I issue close() there

it will be deadlock case, isn't it

servicehost --> service instance --> servicehost.close()



Re: Windows Communication Foundation (Indigo) closing servicehost hosted in windows service

Brian Choi

Simpler question might be

"how do I interact with servicehost instance in windows service directly "

I am considering remoting servicehost.





Re: Windows Communication Foundation (Indigo) closing servicehost hosted in windows service

T.R.Vishwanath - MSFT

http://www.codeproject.com/WCF/AppWatcher.asp#AHostingWCF51 talks about hosting WCF service host inside an NT service. Does this answer your questions

If you dont want serviceHost to block, you could call ServiceHost.Abort instead of ServiceHost.Close.

Thanks

Vish