Strange thing about Services in WCF
This is a strange behaviour I found about the ServiceHost, when you make a service like msmq services and the queue has some messages inside and you write service.Open(), you are expecting that the service will process the messages then leaves, (or that what I was expecting), but the reality is that Open() just opens the service and just when the service starts the Open() function exits and proceeds to next step, so if there is nothing after that keeps the application (Host) running like AutoResetEvent.WaitOne() or an infinite loop, the application will exit without waiting for the messages to be processes...
I tried to find something that makes the Host waits until all the messages are processed but I didn't find anything, and even Micorosft samples that comes with WinFX SDK, all the WCF samples have a Console.ReadKey() after the service.Open(), which means that there is no way to make it wait implicitly without explicitly waits forever...
I contacted a microsoft product manager I met in WinFX tour in egypt yesterday, but he said that he doesn't know a solution for this, and he will ask some MSMQ guys inside microsoft about that, so I hope that this will be fixed by the next CTP, Beta, or Release ...
Have fun....