Click here to Skip to main content
15,867,488 members
Articles / Programming Languages / C++

Deploy a .NET Web Application to IIS on Windows Server

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
31 May 2015CPOL2 min read 40.1K   2  
Deploy a .NET web application to IIS on Windows Server

Since this week, I'm running my websites on a Windows Server 2012. I used to have an Ubuntu Server, but since I'm a .NET developer, a Windows Server is a better choice. I've made a lot of apps for Windows, but never actually deploy a web application to IIS on Windows Server. In this post, I'd like to explain some steps how to deploy your ASP.NET application to IIS.

Note

The method I'm explaining here is fine for deploying simple apps (like blogs or other websites with low user loads), but if you're deploying a mission critical .NET application, you could better set up automatic deployment (which is way out of reach in this post).

Prerequisites

  • Windows Server (or just a Windows PC with IIS installed)
  • Of course, a Windows PC
  • Visual Studio (the community edition is free, even for commercial use)

1. Setting Up Your Project

I've just created a basic web project with some default pages. Next, in the project that contains your actual website, go to Properties => Package / Publish Web.

step1

Make sure the option at Items to deploy equals Only files needed to run this application, and save the configuration.

2. Creating a Package

Right click the project that contains your website and click Publish.

step2

Click Custom and fill in a name for the publishing profile (e.g. "Publishing package"). After that, set the Publishing method to Web Deploy Package. Now you can select the location of the package and define a name.

step3

A few files are created, like you can see below. I'm going to copy the file WebApplication1.zip to my Windows Server using Remote Desktop.

step4

3. Creating a Site in IIS

On your Windows Server, open IIS and create a new website by clicking "Add Website" (or something like that, can't check it because my server language is set to Dutch).

step5

Now, fill in the data needed for your website. You have to fill in the name, the location of the website (just create an empty folder for now) and host name of the site (duco.cc and all subdomains of that domain point to my server, so I've test.duco.cc).

step6

4. Copying the Contents of the ZIP File to the Folder

The actual folder in the ZIP file which contains the files for your website, is concealed deep in the file. The folder is called PackageTmp. Copy the contents of this folder to the newly created website folder. Make sure you change the settings in Web.config to match the settings (e.g. the database connection strings) are set appropriately for your server.

If everything went right and you go to the URL of the website you've just deployed, you will see the actual website. Yay!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Comments and Discussions

 
-- There are no messages in this forum --