Windows服务没有出现在安装serivce(因而无法启动) [英] Windows service not showing up in installed serivce (and hence unable to start)

查看:262
本文介绍了Windows服务没有出现在安装serivce(因而无法启动)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我伸出建立了一个非常简单的Windows服务来测试的东西,建造它得到.exe文件。按照在MSDN这篇文章,我还安装使用Visual服务Studio命令提示符日(跑了作为管理员)installutil TestService.exe。



在使用installutil命令,一切都正常运行,我得到一个消息,说该服务已安装。此外,启动的service,当我(在Visual Studio中的服务器资源管理器)来检查服务节点里面,我没有看到一个名为TestService.exe任何服务

同样,开始菜单 - >我的电脑(右键单击) - >管理 - >服务和应用程序 - >服务不显示TestService.exe,通过它我可以启动该服务



任何建议,我怎么开始?服务



代码的OnStart函数中:

 过程[] testProcess = Process.GetProcessesByName(Notepad.exe的); 
如果(testProcess.Length == 0)
File.WriteAllText(@C:\Users\User1\Desktop\service.txt,无);
,否则
File.WriteAllText(@C:\Users\User1\Desktop\service.txt,运行);


解决方案

我曾与问题installutil 前和使用 SC 命令的工作,而 installutil 没找到。



尝试用这个命令安装你的服务:

  SC创建服务名binPath = serviceexe.exe 


I juts built a very simple windows service to test something and built it to get the .exe. As per this article in MSDN, I also installed the service using the Visual Studio Command Prompt 2010 (ran as administrator) installutil TestService.exe.

On using the installutil command, everything runs fine and I get a message saying the service has been installed. Further, to start the serivce when I check inside the Services nodes (in Server Explorer in Visual Studio), I do not see any service named TestService.exe.
Also, Start Menu -> My Computer (Right Click) -> Manage -> Services and Application -> Services does not show the TestService.exe through which I could start the service.

Any suggestions how do I start the service?

Code inside OnStart function:

 Process[] testProcess = Process.GetProcessesByName("notepad.exe");
            if (testProcess.Length == 0)
                File.WriteAllText(@"C:\Users\User1\Desktop\service.txt", "nothing");
            else
                File.WriteAllText(@"C:\Users\User1\Desktop\service.txt", "run");

解决方案

I have had problems with installutil before and found using the sc command works whereas installutil didn't.

Try installing your service with this command:

sc create servicename binPath= serviceexe.exe

这篇关于Windows服务没有出现在安装serivce(因而无法启动)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆