用C#写的Windows服务在Win7中安装时出现如下错误:

解决方法:

1 安装服务的脚本写在bat文件中,一定要注意路径,如下

D:\Project\JXW\Code\WorkFlow\FlowServer\installutil.exe D:\Project\JXW\Code\WorkFlow\FlowServer\FlowServer.exe

pause

 

net start ShineFlow.FlowServer

2 在bat文件上点击右键-》以管理员身份运行。

3 成功安装服务,如下: