I have a WCF service hosted in a Windows service. When user modifies the WCF service configuration,he needs to restart the service.
I wanted to know if restarting the windows service is better by using
serviceController.stop()
servicecontroller.start()
or by creating a new instance of the WCF client every time he wants to restart it. No information will be lost if created a new instance of the WCF client.
In your service container which is inherited from
System.ServiceProcess.ServiceBaseyou should start your service inside method
and stop your services inside method
so these methods are called automatically when you start/stop windows service from services pallet.
As others said there is no effect of
creating a new instance of the WCF client every timeon your service