简体   繁体   中英

migration from Octopus to TFS 2017 - Publishing ASP.NET web sites

We currently use Octopus Deploy to push web sites to IIS servers hosted on Window Server 2012.

We wish to ditch Octopus and use our on-premises TFS 2017's inbuilt release system instead. We have build definitions that publish artifacts (the web site binaries & content) ready made .

With Octopus we have tentacles installed on all the servers.

The legacy release process defined in Octopus is like so:

  1. Set up IIS (Powershell script to configure app pools for a site, map virtual directory to absolute path)
  2. Deploy nuget package (package contains web site binaries & scripts) - unpacks package containing web site to the physical path of the associated virtual directory
  3. Enable Windows Authentication (one-line powershell script that calls Set-WebConfigurationProperty)
  4. Disable Anon Auth (powershell again.)

I'm not keen on the amount of Powershell used in our Octopus process, and would like to minimise Powershell in the TFS release definition.

My question is: what is the Microsoft recommended way of deploying ASP.NET web sites (vanilla MVC projects, not .NET core) to servers in a CI environment? Is it possible to configure the sites authentication at the same time?

NB: I took a look at the OOB IIS publishing WinRM deployment tasks and I fear they may require more time than our infrastructure team has (to configure firewalls etc.)

We have Visual Studio 2017 installed on the build server.

TIA, Scott

Using the IIS WinRM tasks would probably the best and easiest way to do it. You can find some good guidance of how to configure things.

The basics that you need in place are:

  • Make sure that WinRM is configured on the target server and that your agent can connect to them
  • Package your web site by adding these msbuild parameters when you compile the project /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation=$(Build.ArtifactStagingDirectory)

According to your description you are deploying on a Web site hosted on IIS.

First through TFS build you could use some msbuild arguments such as /p:DeployOnBuild=True /p:SkipInvalidConfigurations=true /p:WebPublishMethod=Package /p:PackageLocation=$(Build.ArtifactStagingDirectory) /p:PackageAsSingleFile=true to generate a package.

Then in release definition use Deploy: Windows Machine File Copy task - Copy the Web Deploy package to the IIS servers. Finally use Deploy: WinRM - IIS Web App Deployment - Deploy the package. This task running on the Build and Release agent opens a WinRM connection to each IIS server to run Powershell scripts remotely in order to deploy the Web Deploy package.

For more detail/step to step tutorial, you could reference below tutorials, even some are the samples for web app:

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