IIS (Internet Information Services) · Operations

Web Deploy

Web Deploy publishes apps to IIS over HTTPS, syncing only changed files and taking the app offline safely during the copy.

Advanced 5 min Lesson 31 of 33Covers IIS 10 on Windows Server 2019/2022/2025 and Windows 10/11.
0/33 in IIS
On this page · 5 min · Advanced

In simple words#

Copying files by hand is moving house box by box. Web Deploy is a moving company with a checklist: it compares old and new rooms, moves only what changed, and puts up a “closed for moving” sign while working.

Web Deploy (msdeploy)
Microsoft tool to sync apps to IIS.
Publish profile
.pubxml file with server, site and credentials settings.
Web Management Service
Remote management endpoint on port 8172.

Learning objectives#

  • Install Web Deploy on the server
  • Publish from Visual Studio or the CLI
  • Use app_offline during deployment
  • Run Web Deploy from CI/CD

Explanation#

Install the Management Service (Web-Mgmt-Service) and Web Deploy with the IIS Deployment Handler on the server. Remote endpoint: https://server:8172/msdeploy.axd.

Visual Studio → Publish → IIS/Web Deploy creates a .pubxml profile. dotnet publish can use it: dotnet publish -p:PublishProfile=Production.

msdeploy -verb:sync compares source and destination and copies only differences. EnableMSDeployAppOffline drops app_offline.htm during the copy so locked DLLs can be replaced.

In CI/CD (GitHub Actions or Azure Pipelines with a self-hosted or Windows agent), call msdeploy with credentials from secrets.

Code example: Sync a published folder to a remote IIS site#

PowerShellSync a published folder to a remote IIS site Illustrative
dotnet publish .\Shop.Web -c Release -o .\publish


& "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" `
  -verb:sync `
  -source:contentPath="$PWD\publish" `
  -dest:contentPath="Shop",computerName="https://web01.example.com:8172/msdeploy.axd?site=Shop",userName="deploy",password="$env:DEPLOY_PASSWORD",authType="Basic" `
  -enableRule:AppOffline `
  -allowUntrusted
Expected output
Info: Adding file (Shop\Shop.Web.dll).
Info: Updating file (Shop\wwwroot\css\site.css).
Total changes: 2 (0 added, 0 deleted, 2 updated, 0 parameters changed, 412 bytes copied)

This example is illustrative. Copy or download it and run it in your own environment; the expected output is shown above.

Step-by-step explanation#

  1. The app is published locally.
  2. msdeploy compares the folder with the remote site.
  3. AppOffline puts the site in maintenance during the copy.
  4. Only changed files are transferred.

Real-world use case#

A team deploys to three Windows web servers from Azure Pipelines using Web Deploy, with zero manual copying.

Common mistakes#

Passwords in publish profiles committed to Git

Use CI secrets or environment variables.

-allowUntrusted in production forever

Install a trusted certificate on the management service instead.

Best practices#

  • Dedicated deploy user with limited rights
  • Secrets from CI, never in .pubxml
  • Always use AppOffline
  • Deploy the same build to every server

Remember this#

msdeploy -verb:sync copies only changes.

Port 8172 = Web Management Service.

AppOffline unlocks files.

Practice exercise#

Your task: Preview what Web Deploy would change without changing anything.

Show solution
PowerShell Illustrative
# add -whatif to the msdeploy command
msdeploy.exe -verb:sync -source:... -dest:... -whatif

Mini quiz#

Web Deploy quizMultiple choice Question 1 of 1

Which port does the IIS Web Management Service use by default?

Score so far: 0/0

Want more? Practise all IIS MCQs · IIS interview questions

My notes#

Saved in this browser.

Progress is saved in this browser. Sign in to sync.