Web Deploy
Web Deploy publishes apps to IIS over HTTPS, syncing only changed files and taking the app offline safely during the copy.
On this page · 5 min · Advanced
On this page
- In simple words
- Learning objectives
- Explanation
- Code example
- Step by step
- Real-world use
- Common mistakes
- Best practices
- Remember this
- Practice exercise
- Mini quiz
- Related topics
- My notes
- Reading time
- 5 min
- Difficulty
- Advanced
- Updated
- Oct 30, 2026
Related tutorials
Interview questions
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#
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
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#
- The app is published locally.
- msdeploy compares the folder with the remote site.
- AppOffline puts the site in maintenance during the copy.
- 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#
Use CI secrets or environment variables.
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
# add -whatif to the msdeploy command
msdeploy.exe -verb:sync -source:... -dest:... -whatif
Mini quiz#
Which port does the IIS Web Management Service use by default?
Want more? Practise all IIS MCQs · IIS interview questions
My notes#
Saved in this browser.