How to Host ASP NET MVC on Windows with IIS

In this tutorial, we are going to Host ASP NET MVC on Windows with IIS. IIS or Internet Information Services are used to host ASP.Net Web applications to either show your development progress for a client or for a test run of your websites. If you are a freelancer and want to show your sites to your customer, IIS might be your best and easiest way.

For beginners like me, I write this article to share how to host ASP.Net MVC Application in windows with IIS.

Also visit : how to enable IIS How to enable Internet Information Services

Let’s Start:

Host ASP.Net on windows:

I. Go to the IIS site’s root folder and create a new folder.

  1. First, open your IIS Manager by going to the start menu and typing “IIS” and select Internet Information Services from the search result. Refer to the image shown below.

You may also use Run then input inetmgr to open IIS Manager.

Start Menu

2. In your IIS manager, expand the sites folder and right click on Default Web Sites. Then select Explore to open the root directory.

IIS Manager
Internet Information Services Manager

3. wwwroot directory appears to create a folder inside the directory. This is where we publish our Websites. In my case, I name it MySites. 

www root directory
wwwroot directory

II. Publish ASP.NET Website

My Site Preview:

ASP.NET website
My Site
  1. Open your project in Visual Studio and go to solution explorer. Right-click on your project name and select publish.
Publish option

2. In the Publish Web Window choose Profile and then create new profile name for your publish profile.

Publish Profile
New Profile
  1. To customize the profile name for this setting you may set a familiar name to easily identify it for the next time you deploy this application. Enter your desired publish profile name. Then press “OK”.
Profile Name
Name your profile

4. Click “Next” to proceed. Select File System as your publish method.

Project Location
Publish Method

5. Select your published directory. In my case, it is C:\inetpub\wwwroot\MySites, which is the default website directory of IIS. Then click “Open.”

Browse project
Select Directory

6. Lastly click on the publish button to proceed. See the image below.

Publish button
Publish Option

7. It may take a while to finish an application to publish. Once, done you can see the notification from the Output windows like the screenshot shown below.

Progress - Host ASP NET MVC on Windows with IIS
Successfully Published

III. Convert your website to IIS Application

  1. Go to your IIS Manager and navigate to Sites » Default Web Sites. Then search for your folder name where we published our websites. In my case, I name it MySites. Right-click on the folder name MySites and select Convert to Application.
Browse application - Host ASP NET MVC on Windows with IIS
Open IIS Manager

You’re done!! To open your website application right click on MySites. Select Manage Application then choose browse.

Manage Application - Host ASP NET MVC on Windows with IIS
IIS Manager

This will open your website in a browser. See the image shown below.

Localhost  - Host ASP NET MVC on Windows with IIS
My Sites

You may also access your websites using your local IP ex.

Ip location - Host ASP NET MVC on Windows with IIS

That’s it you have successfully publish your website into IIS. You can share your website from your local network. Hopefully, this article will give you an idea and can be used with your future project.


Also Read :

Best Computer Services Brisbane

Sony Ericsson Mobile