Install and Configure Web Deploy on IIS

Purpose:

Describes steps to setup an IIS website publish method between servers. This method will push web files from the source server to the destination server at the website level.

Install and Configure Web Deploy Service:

Download version 3.6 https://www.microsoft.com/en-us/download/details.aspx?id=43717

Install on IIS server using Admin level credentials

Select the Change option to adjust the services being installed and make sure the remote agent is installed

clip_image001

Verify the Web Deployment Agent service is installed and the service is to Auto start:

clip_image002

Set System Environment Variable:

On the server, or workstation, where the Web Deploy commands are to be executed, add the path to the MSDeploy.exe to the System Path variable in order to call MSDeploy.exe without a fully qualified path.

Windows Key + X -> System -> Advanced System Settings -> Environment Variables -> Path

Add the path C:\Program Files\IIS\Microsoft Web Deploy V3

clip_image003

How the Web Deploy Service Works:

clip_image004

This method will use the top path to allow only Admins to publish from the source web server to the destination, or target server using the Web Deploy service running on the destination server. The service must be set to auto-start and running to ensure the deployment is successful.

Setup Source IIS Server:

This server maybe part of the release pipeline as the staging, or prod IIS server and hosts the website files to move into the production environment.

Setup the website with the name, bindings, and path to application files comprising the website.

Test website to ensure it is fully functional.

Test the Sync Source to Target:

Verify the Web Deploy service is functional on the target, or destination server, by issuing the following commands from the command line:

msdeploy -verb:sync -source:apphostconfig="FabrikamDev" -dest:apphostconfig="FabrikamDev",computername=10.0.0.2 -whatif -verbose

The -source and -destination websites must be changed to match your environment as well the name, or IP of the remote server.

Here is a breakout of the syntax for Web Deploy:

clip_image005

Setup Script to Publish:

The method to perform the actual publish action is by removing the -verbose command and this will commit the changes to the remote IIS server.

msdeploy -verb:sync -source:apphostconfig="FabrikamDev" -dest:apphostconfig="FabrikamDev",computername=10.0.0.2

Troubleshooting Web Deploy and other Resources:

Blog on different options with Web Deploy: https://blogs.msdn.microsoft.com/ericparvin/tag/web-deploy/

Errors publishing from Visual Studio and Console: https://www.iis.net/learn/publish/troubleshooting-web-deploy/troubleshooting-web-deploy-problems-with-visual-studio

Troubleshooting Common Errors: https://www.iis.net/learn/publish/troubleshooting-web-deploy/troubleshooting-common-problems-with-web-deploy

Web Deploy Error Codes: https://www.iis.net/learn/publish/troubleshooting-web-deploy/web-deploy-error-codes

Log File Location:

C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp\MSDepSvc.log