简体   繁体   中英

.NET Web Application and Windows Service Automatic Deployment

The 2 projects need to be deployed to multiple environments, over VPN . Additional environments will be required over time.

Current deployment strategy:

Using CCNet for build automation.

Web Application:

  • Web deployment packages
  • MSBuild
  • Web Deploy

Windows Service:

  • MsBuild
  • RoboCopy + Net Share
  • MSBuild Extension Pack to (un)install start/stop service

Problems with the current strategy:

  • Web Deploy needs to be installed on all targeted web servers.
  • IIS Configuration: (remote management service, users, delegation rules)
  • Net share required for service file copy and install
  • MSBuild Extension Pack Dependency
  • UAC disabled for service install

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.

Looking for a way to deploy the web application and also the windows service with less configuration requirements.

Alternatives?

CCNET buildpublisher

Instead of Web deployment packages.

Would remove Web Deploy dependency but not sure it works over VPN and do not see a way to specify a username/password.

sc.exe

To install/uninstall services.

Would remove MSBuild Extension Pack and Robo Copy dependency.

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.

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

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.

For copying files you could use a UNC share to achieve your result. This would satisfy the desire to reduce the requirements on installing tools in the servers, presuming UNC is an option.

Other options could be:

  1. Install ftp on the servers and upload the files via 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.

As for installing/updating windows services you will most probably require a hosted service of some sort to orchestrate the association with windows.

Other options could be:

  1. Use psexec to run sc.exe, once you've copied the files (that are build via ccnet)
  2. Write a service/webapp that runs with sufficiently high privileges to install and control services via .net

These are merely options, not suggestions, personally I would have thought that WebDeploy on its own would suffice. The pain of installing WebDeploy is far outweighed by the safety and security it offers. Personally I wouldn't want any UNC access to or from my servers (secure network or not) so I would not recommend this option.

One possible solution could be:

  1. Use WebDeploy to issue the new/updated site files; WebDeploy can create new websites and applications as required. You should be able to reuse this for windows services also.
  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

This should all be possible with just WebDeploy installed on the servers and the ccnet server.

IIS remote management, file shares and the msbuild (and its pack) would not be required, reducing some of your configuration. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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