简体   繁体   English

.NET Web应用程序和Windows服务自动部署

[英].NET Web Application and Windows Service Automatic Deployment

The 2 projects need to be deployed to multiple environments, over VPN . 这两个项目需要通过VPN部署到多个环境。 Additional environments will be required over time. 随着时间的推移,将需要其他环境

Current deployment strategy: 当前部署策略:

Using CCNet for build automation. 使用CCNet进行构建自动化。

Web Application: Web应用程序:

  • Web deployment packages Web部署包
  • MSBuild 的MSBuild
  • Web Deploy 网络部署

Windows Service: Windows服务:

  • MsBuild 的MSBuild
  • RoboCopy + Net Share RoboCopy +网络共享
  • MSBuild Extension Pack to (un)install start/stop service MSBuild Extension Pack可以(取消)安装启动/停止服务

Problems with the current strategy: 当前策略存在的问题:

  • Web Deploy needs to be installed on all targeted web servers. Web Deploy需要安装在所有目标Web服务器上。
  • IIS Configuration: (remote management service, users, delegation rules) IIS配置:(远程管理服务,用户,委派规则)
  • Net share required for service file copy and install 服务文件复制和安装所需的净共享
  • MSBuild Extension Pack Dependency MSBuild扩展包依赖性
  • UAC disabled for service install 禁用UAC进行服务安装

Overall it does not seem that bad but considering this needs to be set up for a lot of environemnts it quickly becomes a problem. 总体而言,这似乎并不坏,但是考虑到需要针对许多环境进行设置,这很快就成为问题。

Also creating the net share, disabling the UAC, IIS remote management service might be considered security issues. 另外,创建网络共享,禁用UAC,IIS远程管理服务也可能被视为安全问题。

Looking for a way to deploy the web application and also the windows service with less configuration requirements. 寻找一种方式来部署Web应用程序以及具有较少配置要求的Windows服务。

Alternatives? 备择方案?

CCNET buildpublisher CCNET构建发布者

Instead of Web deployment packages. 而不是Web部署程序包。

Would remove Web Deploy dependency but not sure it works over VPN and do not see a way to specify a username/password. 将删除Web Deploy依赖关系,但不确定它是否可以在VPN上运行,并且看不到指定用户名/密码的方法。

sc.exe SC.EXE

To install/uninstall services. 安装/卸载服务。

Would remove MSBuild Extension Pack and Robo Copy dependency. 将删除MSBuild Extension Pack和Robo Copy依赖项。

This seems to be working on domain computers but also not sure about VPN connections and UAC seems to be a problem in this case also. 这似乎在域计算机上正常工作,但也不确定VPN连接,在这种情况下,UAC似乎也是一个问题。

Powershell? 电源外壳?

Update: 更新:

Managed to install the service using powershell: http://www.geoffhudik.com/tech/2012/3/22/install-a-windows-service-remotely-with-powershell.html 使用Powershell管理安装服务: http : //www.geoffhudik.com/tech/2012/3/22/install-a-windows-service-remotely-with-powershell.html

One way of doing it. 一种方法。 Had an issue when creating the drive share using MapNetworkDrive on Windows 7, so I had to do this with net use Still considering alternatives. 在Windows 7上使用MapNetworkDrive创建驱动器共享时出现问题,因此我必须使用net use来完成此操作。仍在考虑替代方法。

For copying files you could use a UNC share to achieve your result. 对于复制文件,您可以使用UNC共享来获得结果。 This would satisfy the desire to reduce the requirements on installing tools in the servers, presuming UNC is an option. 假定可以选择使用UNC,这将满足减少服务器中安装工具要求的需求。

Other options could be: 其他选项可能是:

  1. Install ftp on the servers and upload the files via ftp 在服务器上安装ftp并通过ftp上传文件
  2. Write a service/webapp that accepts a zip file (or series of files) - at this point your basically reinventing ftp or web deploy though. 编写一个接受zip文件(或一系列文件)的服务/ webapp-在这一点上,您基本上是在重塑ftp或web部署。

As for installing/updating windows services you will most probably require a hosted service of some sort to orchestrate the association with windows. 至于安装/更新Windows服务,您很可能需要某种托管服务来协调与Windows的关联。

Other options could be: 其他选项可能是:

  1. Use psexec to run sc.exe, once you've copied the files (that are build via ccnet) 复制文件(通过ccnet构建)后,使用psexec运行sc.exe。
  2. Write a service/webapp that runs with sufficiently high privileges to install and control services via .net 编写以足够高的特权运行的服务/ webapp,以通过.net安装和控制服务

These are merely options, not suggestions, personally I would have thought that WebDeploy on its own would suffice. 这些只是选项,不是建议,就我个人而言,我认为WebDeploy就足够了。 The pain of installing WebDeploy is far outweighed by the safety and security it offers. 它提供的安全性和安全性远远超过了安装WebDeploy的痛苦。 Personally I wouldn't want any UNC access to or from my servers (secure network or not) so I would not recommend this option. 就我个人而言,我不希望任何UNC访问或访问我的服务器(无论是否安全网络),因此我不建议您使用此选项。

One possible solution could be: 一种可能的解决方案可能是:

  1. Use WebDeploy to issue the new/updated site files; 使用WebDeploy发行新的/更新的站点文件; WebDeploy can create new websites and applications as required. WebDeploy可以根据需要创建新的网站和应用程序。 You should be able to reuse this for windows services also. 您还应该能够将其重新用于Windows服务。
  2. For windows services, the use the WebDeploy runCommand provider to stop and start your service before and after the update, see http://technet.microsoft.com/en-us/library/ee619740(v=WS.10).aspx 对于Windows服务,请使用WebDeploy runCommand提供程序在更新前后停止和启动服务,请参阅http://technet.microsoft.com/zh-cn/library/ee619740(v=WS.10).aspx

This should all be possible with just WebDeploy installed on the servers and the ccnet server. 只要在服务器和ccnet服务器上安装WebDeploy,就应该可以做到这一点。

IIS remote management, file shares and the msbuild (and its pack) would not be required, reducing some of your configuration. 不需要IIS远程管理,文件共享和msbuild(及其包),从而减少了一些配置。 The install and config of WebDeploy could be automated: http://www.iis.net/learn/publish/using-web-deploy/powershell-scripts-for-automating-web-deploy-setup WebDeploy的安装和配置可以自动进行: http ://www.iis.net/learn/publish/using-web-deploy/powershell-scripts-for-automating-web-deploy-setup

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM