Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【demo演示】一键发布WindowsService项目(netframwork版本) #4

Open
yuzd opened this issue Feb 16, 2019 · 1 comment
Open
Labels
good first issue Good for newcomers

Comments

@yuzd
Copy link
Owner

yuzd commented Feb 16, 2019

前提:由于是演示WindowsService项目所以得部署好agent

参考:#1
注意:Windows 服务器上 需要安装一个agent 就是 安装一个windows服务,用来处理iis的发布和windows服务的发布,可以点击上面的参考链接进行安装。
注意: 得用管理员权限部署agent 防止会出现部署到Windows 服务上权限不足问题

1. 新建一个Windows服务项目

image

image

2.设置好ServiceName 和 描述

这里要记下你设置的ServiceName 后面要用到
image

3.设置安装权限

右键serviceProcessInsraller1,选择属性,将Account的值改为LocalSystem。
image

4.打开Service,cs代码 写入逻辑

image

5.在工程上点击右键 然后选择 AntDeploy

image

6配置AntDeploy

6.1添加一个环境 名字叫 测试

image

6.2在 测试环境里面添加 windows服务器 这里我做测试就添加就是我本机,注意Host里面是填写格式为:ip:端口号

image
注意:Token不是windows服务器的密码!!!是安装agent后,agent的配置文件里面配置的Token(你自己自定义配置的)
注意:Port不是你要发布的项目的端口号!!!是安装agent后,agent的配置文件里面配置的端口号(你自己自定义配置的)
点击【Connect Test】按钮进行确认agent可以成功链接,否则会发布失败
如果【Connect Fail】失败 请查看 #10

6.3进入 WindowsService Tab界面

Sdk类型选择 netframework
ServiceName 填写上面我们设置的名称:[TestService]
image

点击 【Deploy】按钮进行发布
如下图所示:
image

确认服务器无误 点击 【是】开始执行一键部署
如果发布出现错误会出现下图所示:
image

可以在Log里面查看失败原因是因为我部署agent没有用管路员权限 报权限不足失败
image

部署成功 如下图:
image

查看D盘下是否log.txt是否正常每隔1秒写入了当前时间
image

这里演示的是windows服务上没有这个service
所以自动创建了。
如果service已存在的情况 Deploy 就会全量覆盖 不会重新创建site的。
如果想要覆盖时排除指定文件 可以在 Setting Tab界面的IgnoreList里面增加(支持正则)

@yuzd yuzd added the good first issue Good for newcomers label Feb 18, 2019
@yuzd
Copy link
Owner Author

yuzd commented Feb 20, 2019

【demo演示】一键发布WindowsService项目(netcore) #5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant