Details
-
Bug
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
Some Release
-
None
-
Windows 7
* Qt Creator 3.6.0
* MinGW 4.8 32bit
* MinGW 4.9.2 32bit
Linux (Centos 6.5)
* Qt Creator 3.0.1
* GCC g++ 4.4.6 64bit
Description
When upgrading my Qt libraries to 5.5.1 I found that QtService would not start as a service on Windows, either by using the service Controller methodology (from the QtService example code) or via the Services mmc in control panel. The error code I get is #1053: "The service did not respond to the start or control request in a timely fashion."
The problem seems to happen at the call to pStartService in QtServiceController::start in qtservice_win.cpp
qtservice_win.cpp
bool QtServiceController::start(const QStringList &args) { Q_D(QtServiceController); bool result = false; if (!winServiceInit()) return result; // Open the Service Control Manager SC_HANDLE hSCM = pOpenSCManager(0, 0, SC_MANAGER_CONNECT); if (hSCM) { // Try to open the service SC_HANDLE hService = pOpenService(hSCM, (wchar_t *)d->serviceName.utf16(), SERVICE_START); if (hService) { QVector<const wchar_t *> argv(args.size()); for (int i = 0; i < args.size(); ++i) argv[i] = (const wchar_t*)args.at(i).utf16(); if (pStartService(hService, args.size(), argv.data())) // <-- This Fails result = true; pCloseServiceHandle(hService); } pCloseServiceHandle(hSCM); } return result; }
Some things to note:
- The service functionality works as expected for Qt Libraries 4.6.2, 4.8.5, & 5.2.1 on Windows 7 (I have not tested other versions).
- I have no trouble at all on Linux (Qt libraries: 4.6.2, 4.8.5, 5.2.1, 5.4.2, & 5.5.1).
- On Windows, for libraries greater than 5.2.1, I am able to run the service as an application using the -e commandline switch (e.g., C:\> myservice -e "ServiceName")