0
votes

I created WCF service, using windows service application, i gave reference as wcf service dll to window service application, and i created exe using innosetup,for creating setup i followed this How to deploy WCF services using INNO setup? ,now how can i start the service automatically, after finishing the installation,service should start automatically.how it is possible? can i get any command line to achieve this task?

Regards, Lokesh.J

1
I don't know what do you mean with any command line, but it's quite obvious from this post that the code in the [Run] section executes a command line with --install parameter, isn't it ?TLama
yes,actually it put entry in window service,but it doesn't start the service automatically, user need to start the service manually, i don't want user to start the service manually. how can i achieve it?lokesh
Add a --start parameter to the command line and make your application start the service itself when it receives it. (There are other ways, but this always seems the cleanest to me.) Don't forget that you need to stop the service on uninstall and reinstall too.Miral

1 Answers

0
votes

you can use the following code to create a service and service will start automatically.

// create a system service with windows command “sc”
DosCmd := '/C '+'sc create "WCF" binPath= "'+ExpandConstant('{app}\WCF.exe' \
  type= share start= auto DisplayName= "WCF"'+' obj= '+UserName+' password= '+Passwd;
Exec(ExpandConstant('{cmd}'),DosCmd, '',  SW_HIDE,ewWaitUntilTerminated, ResultCode);

and then, the WCF service will start automatically.