windows系统服务配置详解,以及开发好的windows服务怎么部署上去

一、配置服务

1、WIN + R 打开运行窗口,输入cmd

2、输入 sc create ServerName binpath= "E:\myTest.exe" 等号后有空格
sc create ServerName binpath= "E:\myTest.exe"
如此这般,就讲ServerName加入到了服务当中

3、启动服务 sc start ServerName
sc start ServerName

4、WIN + R 打开运行窗口,输入services.msc ,可以看到你刚新建的服务,名称是ServerName,右键选择属性改成自动

5、删除服务 sc delete ServerName 其实删除后就是禁用
sc delete ServerName

备注:输入 sc -help 可获取到命令详细。

二、手动添加服务
1.以管理员身份运行cmd ,必须是管理员!

2.安装windows服务

cd C:\Windows\Microsoft.NET\Framework\v4.0.30319
定位到.net下InstallUtil.exe的文件夹

3.安装windows服务

InstallUtil.exe E:\myTest.exe

4.启动windows服务

net start myTest

运行cmd输入:services.msc 找到对应的服务启动

——————————————————————————————————————————————————————————————
Redis后台运行。
将redis-service.exe作为服务,就可以在后台运行
Redis作为服务有其自己的简单命令。
1:cmd先进入redis目录,执行命令 redis-service --service-install redis.windows.conf

C:\user\cc>G:
G:\>G:\Redis
G:\Redis>redis-service --service-install redis.windows.conf

2:开启服务,后台即运行,也可以去services.msc找到Redis开启停止
G:\Redis>redis-service --service-start

停止服务
G:\Redis>redis-service --service-stop

posted @ 2024-07-11 10:12  cry_cai  阅读(1794)  评论(0)    收藏  举报