Windows服务问题
Windows Service issue
我正在尝试让windows服务使用c++。这项服务目前没有什么特别之处。服务运行的代码是
int main(int argc, char** argv) {
if (argc != 1) return -1;
ofstream fTestFile;
fTestFile.open("C:\ABC\ServiceTest.txt", ios::app);
fTestFile << "argc=" << argc << endl;
for (int i=0;i <argc;i++)
fTestFile << "argv " << i << "=: " <<argv[i] << endl;
for (int i=0; i<100000; i++) {
fTestFile << i << ",";
if (i % 50 == 0) fTestFile << "n";
Sleep(10);
}
fTestFile << "n";
return 0;
}
当我在此服务上通过services.msc单击"启动"时,该服务尝试启动,但失败,返回(1053错误,响应时间过长)。在servicetest.txt文件中,我看到了一些数据,比如调试语句和2663之前的数字。
有没有我错过的一步,任何帮助都非常感谢。
谢谢
您的服务需要与服务管理器(services.exe)通信,以报告和更新其当前状态。
在此处阅读http://msdn.microsoft.com/en-us/library/windows/desktop/ms687414%28v=vs.85%29.aspx
相关文章:
- 警告处理为错误这里有什么问题
- 最小硬币更换问题(自上而下方法)
- 为"adjacent"变量赋值时出现问题
- 我的神经网络不起作用 [XOR 问题]
- 在Ubuntu 16.04上安装Cilk时出现问题
- C++我的数学有什么问题,为什么我的代码不能正确循环
- 编译包含字符串的代码时遇到问题
- Project Euler问题4的错误解决方案
- 问题:什么是QAbstractItemView::NoEditTriggers的反面
- 在编译C++代码(具有dlib和opencv)到WASM时面临问题
- 在进程中对同一管道进行读取和写入时C++管道出现问题
- 静态数据成员的问题-修复链接错误会导致编译器错误
- C++ 雷神库 - 使用资源加载器类时出现问题(不命名类型)
- 在 Windows 服务中使用命名管道时出现问题
- 在 win32 服务中生成卡萨布兰卡http_listener的问题 (C++)
- Win7 C++ - 从以用户身份登录的服务启动可执行文件的问题
- 问题5.2.0缺少摄像头服务
- Moodle REST Web 服务:将数组作为 POST 参数发送时出现问题
- Windows服务问题
- Boost asio:io服务在销毁步骤中被阻止了更多的处理程序问题