I'm trying to install a NT Service and have problems doing so, all the other service threads in this forum indicates that I'm not the only one but no one seems to have a solution.
If I was to install my service without IS, I would just run it from the command line with service.exe -i.
How would I do this in IS? Using the install service under the component, adds the service to the list in control panel but it cannot be started - it immediately says "the service did not respond in a timely fashion".
What is the meaning of the command-line field in the install service screen? Is this where I place my -i? (Doing so has no effect however).
Is my only option to actually skip the IS way and run my exe after it is installed? I'd rather not as I want a msm that does all this without the parent installer having to call any custom actions.
(I've had this problem before with 2 other services not developed by myself and just thought the problem was with the service's and not IS).
I changed the 'Error Control' from 'Log the error and restart' to 'log the error, display a message and continue'. Then suddenly my service was installed and it started. I then changed this setting back to what I had and it still works. I guess something 'reset' the component and maybe took out something funny because...
I could not delete the service at uninstall with control services. It would stop but will still be listed. I then looked in the ServiceControl table in Direct Editor and the name of the service was name.GUID. I removed the GUID and now it works.
Is this a bug in the IDE? Feels like I've read more than one post where something adds bogus data to the components and they need to be 'reset'...
I don't know if I can help you but I've into the same problem with Inoculan and PowerChute which both install service drivers and filesystem drivers (which are not supported by Windows Installer).
Other types of services are installed and started by IS with no problem.
It seems I've found a solution (I tried it for PowerChute) by creating a dll with functions to install, start and delete the UPS service (using InstallService, DeleteService, OpenSCManager...).
My service is installed and started. But I've'nt tested PowerChute in a production environment yet and it's a bit complicated (actually not that much) but it's the only solution I have yet.
if (schService == NULL)
{
MyError ("OpenService");
return -1;
}
if (!StartService(
schService, // handle to service
0, // number of arguments
NULL) ) // no arguments
{
MyError ("StartService");
}
else
{
cerr << "Service start pending.\n";
}
// Check the status until the service is no longer start pending.
if (!QueryServiceStatus(
schService, // handle to service
&ssStatus) ) // address of status information structure
{
MyError ("QueryServiceStatus");
}
while (ssStatus.dwCurrentState == SERVICE_START_PENDING)
{
// Do not wait longer than the wait hint. A good interval is
// one tenth the wait hint, but no less than 1 second and no
// more than 10 seconds.
if (!QueryServiceStatus(
schService, // handle to service
&ssStatus) ) // address of structure
break;
if ( ssStatus.dwCheckPoint > dwOldCheckPoint )
{
// The service is making progress.
dwStartTickCount = GetTickCount();
dwOldCheckPoint = ssStatus.dwCheckPoint;
}
else
{
if(GetTickCount()-dwStartTickCount > ssStatus.dwWaitHint)
{
// No progress made within the wait hint
break;
}
}
}
if (ssStatus.dwCurrentState == SERVICE_RUNNING)
{
cerr << "StartService SUCCESS.\n";
dwStatus = NO_ERROR;
}
else
{
printf("\nService not started. \n");
printf(" Current State: %d\n", ssStatus.dwCurrentState);
printf(" Exit Code: %d\n", ssStatus.dwWin32ExitCode);
printf(" Service Specific Exit Code: %d\n",
ssStatus.dwServiceSpecificExitCode);
printf(" Check Point: %d\n", ssStatus.dwCheckPoint);
printf(" Wait Hint: %d\n", ssStatus.dwWaitHint);
dwStatus = GetLastError();
}