This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Installing Windows Service Fails??
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 16, 2007
09:15 AM
Installing Windows Service Fails??
I am using IS2008 Pre . My project type is InstallScript. I wanted to install windows service called abcd.exe on windows(Vista).
I am trying to installservice using following lines of code. after running setup i can see the service in Service Control and whenever i try to START it it fails saying that Windows cannot find the service. I tried rebooting the machine but it still fails to start.
function OnMoved()
begin
ServiceAddService("ABC.exe","ABC","MyService",TARGETDIR,TRUE,"");
SERVICE_IS_PARAMS.dwServiceType =
SERVICE_WIN32_OWN_PROCESS|SERVICE_INTERACTIVE_PROCESS;
SERVICE_IS_PARAMS.dwStartType = SERVICE_AUTO_START;
SERVICE_IS_PARAMS.dwErrorControl = SERVICE_ERROR_IGNORE;
ServiceStartService("ABC.exe","");
Am I doing it right way?
Any help will be highly appreciated.
Thanks in advance.
Kurt.
I am trying to installservice using following lines of code. after running setup i can see the service in Service Control and whenever i try to START it it fails saying that Windows cannot find the service. I tried rebooting the machine but it still fails to start.
function OnMoved()
begin
ServiceAddService("ABC.exe","ABC","MyService",TARGETDIR,TRUE,"");
SERVICE_IS_PARAMS.dwServiceType =
SERVICE_WIN32_OWN_PROCESS|SERVICE_INTERACTIVE_PROCESS;
SERVICE_IS_PARAMS.dwStartType = SERVICE_AUTO_START;
SERVICE_IS_PARAMS.dwErrorControl = SERVICE_ERROR_IGNORE;
ServiceStartService("ABC.exe","");
Am I doing it right way?
Any help will be highly appreciated.
Thanks in advance.
Kurt.
(6) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 16, 2007
09:34 AM
You might double-check the arguments to ServiceAddService: the first argument is apparently the internal service name (such as "ABC"); second and third the display name and description in the Services administrative tool; fourth the full path to the service executable (TARGETDIR^"abc.exe", perhaps?); and so on.
Since the service appears in the Services administrative tool, perhaps look at its properties and see what looks wrong?
The ServiceAddService help topic has more information, including information about interpreting error codes.
Since the service appears in the Services administrative tool, perhaps look at its properties and see what looks wrong?
The ServiceAddService help topic has more information, including information about interpreting error codes.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 16, 2007
10:01 AM
Robert,
I made the changes suggested by you,
Now my code looks like
ServiceAddService("ABC","XYZ","Service Agent",TARGETDIR^"\\A\\B\\ABC.exe",TRUE,"");
SERVICE_IS_PARAMS.dwServiceType =
SERVICE_WIN32_OWN_PROCESS|SERVICE_INTERACTIVE_PROCESS;
SERVICE_IS_PARAMS.dwStartType = SERVICE_AUTO_START;
SERVICE_IS_PARAMS.dwErrorControl = SERVICE_ERROR_IGNORE;
ServiceStartService("ABC.exe","");
Now i can see the Service in Service Control with startup type set to Automatic(instead of Disabled as in previous case) , but whenever i access the properties it doesnt show full path to executable. In this case it is
C:\A\B\C instead of C:\ProgramFiles\B\C\Service.exe.
my TARGETDIR=PROGRAMFILES ^"B\\C".
Also when i try to start service it says cannot Start service on Local Computer, however my service installs just fine using installutil manually from the targetdir.
What is wrong am i doing?
Thanks a ton
I made the changes suggested by you,
Now my code looks like
ServiceAddService("ABC","XYZ","Service Agent",TARGETDIR^"\\A\\B\\ABC.exe",TRUE,"");
SERVICE_IS_PARAMS.dwServiceType =
SERVICE_WIN32_OWN_PROCESS|SERVICE_INTERACTIVE_PROCESS;
SERVICE_IS_PARAMS.dwStartType = SERVICE_AUTO_START;
SERVICE_IS_PARAMS.dwErrorControl = SERVICE_ERROR_IGNORE;
ServiceStartService("ABC.exe","");
Now i can see the Service in Service Control with startup type set to Automatic(instead of Disabled as in previous case) , but whenever i access the properties it doesnt show full path to executable. In this case it is
C:\A\B\C instead of C:\ProgramFiles\B\C\Service.exe.
my TARGETDIR=PROGRAMFILES ^"B\\C".
Also when i try to start service it says cannot Start service on Local Computer, however my service installs just fine using installutil manually from the targetdir.
What is wrong am i doing?
Thanks a ton
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 16, 2007
11:43 AM
One thing is, I think the argument to ServiceStartService should be the internal service name used as the first argument to ServiceAddService.
If you display the value of TARGETDIR (or better yet, TARGETDIR^"A\\B\\abc.exe") before calling ServiceAddService, is the value correct?
If you display the value of TARGETDIR (or better yet, TARGETDIR^"A\\B\\abc.exe") before calling ServiceAddService, is the value correct?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 16, 2007
12:37 PM
Robert I checked the value of TARGETDIR..its correct.
I am now trying following piece of code:
ServiceAddService("ABC","ABC","Service Agent",TARGETDIR^"ABC.exe",TRUE,"");
SERVICE_IS_PARAMS.dwServiceType =
SERVICE_WIN32_OWN_PROCESS|SERVICE_INTERACTIVE_PROCESS;
SERVICE_IS_PARAMS.dwStartType = SERVICE_AUTO_START;
SERVICE_IS_PARAMS.dwErrorControl = SERVICE_ERROR_NORMAL;
if ServiceStartService("ABC","")< ISERR_SUCCESS then
MessageBox("Error Starting Service",SEVERE);
endif;
and i get "Error Starting Service" error.
I have no idea whats wrong with this.
Any more suggestion?
Thanks
Manas.
I am now trying following piece of code:
ServiceAddService("ABC","ABC","Service Agent",TARGETDIR^"ABC.exe",TRUE,"");
SERVICE_IS_PARAMS.dwServiceType =
SERVICE_WIN32_OWN_PROCESS|SERVICE_INTERACTIVE_PROCESS;
SERVICE_IS_PARAMS.dwStartType = SERVICE_AUTO_START;
SERVICE_IS_PARAMS.dwErrorControl = SERVICE_ERROR_NORMAL;
if ServiceStartService("ABC","")< ISERR_SUCCESS then
MessageBox("Error Starting Service",SEVERE);
endif;
and i get "Error Starting Service" error.
I have no idea whats wrong with this.
Any more suggestion?
Thanks
Manas.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 16, 2007
12:48 PM
If you haven't yet, please see the InstallShield help for that function for information about how to interpret specific error codes (the return value from ServiceStartService, for example)...
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 16, 2007
11:44 PM
coedindigo wrote:
Robert I checked the value of TARGETDIR..its correct.
I am now trying following piece of code:
ServiceAddService("ABC","ABC","Service Agent",TARGETDIR^"ABC.exe",TRUE,"");
SERVICE_IS_PARAMS.dwServiceType =
SERVICE_WIN32_OWN_PROCESS|SERVICE_INTERACTIVE_PROCESS;
SERVICE_IS_PARAMS.dwStartType = SERVICE_AUTO_START;
SERVICE_IS_PARAMS.dwErrorControl = SERVICE_ERROR_NORMAL;
if ServiceStartService("ABC","")< ISERR_SUCCESS then
MessageBox("Error Starting Service",SEVERE);
endif;
and i get "Error Starting Service" error.
I have no idea whats wrong with this.
Any more suggestion?
Thanks
Manas.
Did you use the parameter SERVICE_IS_PARAMS.nStartServiceWaitCount
with the value 0? Possibly try this. If the problem occurs then please post the installation log file.