DEV Community

Cover image for Publish Web App from Visual Studio to IIS Using Web Deploy
Ahmed Hesham
Ahmed Hesham

Posted on • Edited on

9 1

Publish Web App from Visual Studio to IIS Using Web Deploy

Introduction

There are several ways you could publish your Web App from Visual Studio. The simplest way is to publish to a folder, then copy paste to the hosting server, IIS for example.

But it's always better to automate these operations; it makes them faster (no need to copy all files, just the changed ones), and less likely to cause mistakes (replace appsettings.json or web.config file).
It also opens the door to more advanced operations, like zero downtime deployment, which I plan to write about in the next post.

In this post I'll write about how to publish a Web App in Visual Studio to IIS using Web Deploy. When things are set up, you will only need to click the publish button in Visual Studio to publish your app.

What is Web Deploy?

Prerequisites

  • IIS 7
  • Visual Studio 2010

Steps

Note: The order of steps is important.

1. Install Web Management Service (WMSVC)

  1. In remote server, open Control Panel -> Turn Windows features on or off.
  2. Look for Internet Information Services (IIS) -> Management Tools -> check Management Service.
  3. Proceed to install.

Check Management Service

2. Download and Install Web Platform Installer (WebPI)

It's recommended to use WebPI instead of directly downloading tools; because WebPI also gets the dependencies and configures these tools depending on the current system settings.

Web Platform Installer

3. Get Web Deploy

  1. Open WebPI directly (start menu for example), not through IIS Manager.
  2. Search for Web Deploy, then install.

Install Web Deploy from WebPI

Note: If Web Deploy is already installed, uninstall it (from Control Panel, not repair), then repeat above steps.

4. Add Port 8172 to Exceptions

This port gets added automatically to Windows Firewall exceptions if you followed the above steps.

Make sure the port is open through the path from the development environment to the hosting server, for example if you are using EC2, add the port to the Inbound Rules of the Security Group.

5. Create New Publish Profile in Visual Studio

  1. Open the project you want to publish, then create a new publish profile.
  2. Select Web Server (IIS) -> Web Deploy.
  3. Write the server details as follow:
    • Server: https://(ip or name):8172/msdeploy.axd
    • Site name: site/application as in IIS
    • Username and Password are windows credentials.
  4. Click Finish.
  5. You might need to add <AllowUntrustedCertificate>True</AllowUntrustedCertificate> to the publish profile found under solution tree: YourProject -> Properties -> PublishProfiles.

Publish Profile

6. Publish Your Project

We finished setting up Web Deploy, now you just need to click publish, and Web Deploy will do all the work for you.

See Also

Web Deploy with command line

Image of Stellar post

🚀 Stellar Dev Diaries Series: Episode 1 is LIVE!

Ever wondered what it takes to build a web3 startup from scratch? In the Stellar Dev Diaries series, we follow the journey of a team of developers building on the Stellar Network as they go from hackathon win to getting funded and launching on mainnet.

Read more

Top comments (0)

Billboard image

Try REST API Generation for MS SQL Server.

DreamFactory generates live REST APIs from database schemas with standardized endpoints for tables, views, and procedures in OpenAPI format. We support on-prem deployment with firewall security and include RBAC for secure, granular security controls.

See more!

👋 Kindness is contagious

Dive into this thoughtful article, cherished within the supportive DEV Community. Coders of every background are encouraged to share and grow our collective expertise.

A genuine "thank you" can brighten someone’s day—drop your appreciation in the comments below!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found value here? A quick thank you to the author makes a big difference.

Okay