Last post Oct 14, 2008 07:26 AM by mas_anand
Jun 29, 2008 12:05 PM|TATWORTH|LINK
For all those working with Windows Services to support ASP.NET web and web service sites, here is a tip gleaned from LabMonkey on Code Project at
To automatically start the Service during the install:
1) Add a "ServiceController" object from the toolbox to the ProjectInstaller design pane.
2) in the ServiceController's properties set the ServiceName property to the name of your service (the one you are installing).
3) On the project Installer design pane double click the serviceInstaller object - this should add a serviceInstaller_AfterInstall event.
4) In the AfterInstall event call the Start() method of the serviceController object. Would look something like this:
serviceInstaller1_AfterInstall(object sender, InstallEventArgs e)
That is it. Now rebuild both the service and the setup and try it out.
Oct 14, 2008 07:26 AM|mas_anand|LINK
This is not working for me if i put the code in after install event.( i mean if i allow the service to interact with desktop)
It is working fine if i put the code in commited event.