How to deploy ASP.NET Web Application in IIS in windows Machine

In this tutorial, we are going to learn how to deploy ASP.NET web application in IIS on a Windows Machine. 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 customers, IIS might be your best and easiest way.

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

Before we start make sure that you have enabled IIS on your Windows machine. If not, follow the steps provided below.

I. Enable IIS on Windows 10

It’s really easy to enable Internet Information Services in Windows 10. Internet Information Services (IIS) is a Microsoft-developed extended web server that may be used with Windows NT; also, ASP.NET developers will want to enable IIS, since it is required to host ASP.NET. IIS has an interactive user interface that makes configuring the server simple.

To enable IIS and the required IIS components on Windows 10, do the following:

  1. Open the Control Panel and click Programs and Features » Turn Windows features on or off.
  2. Enable Internet Information Services.
  3. Expand the Internet Information Services feature and verify the web server components that is needed for IIS to work. Refer to the required IIS component listed below.
  4. Click OK.

Required IIS components

  • Web Management Tools
    • IIS 6 Management Compatibility
      • IIS Metabase and IIS 6 configuration compatibility
    • IIS Management Console
  • World Wide Web Services
    • Application Development Features
      • .NET Extensibility 4.5
      • ASP.NET 4.5
      • ISAPI Extensions
      • ISAPI Filters
      • WebSocket Protocol
    • Common HTTP Features
      • Default Document
      • Static Content
    • Security
      • Basic Authentication
      • Request Filtering
      • Windows Authentication

II. How to Check IIS Version on Windows 10

  1. Open Run Command using the shortcut Win Key + R.
  2. Search for inetmgr.
  3. Internet Information Services(IIS) manager will open.
  4. Click on Help.
  5. Go to “About Internet Information Services
  6. “About Internet Information Services manager dialog box will now open, where you can view details on about your IIS.

III. Set Up IIS on Windows

To deploy your ASP.NET web application, you’ll need to configure IIS. Follow these steps:

  1. First, open your IIS Manager by going to the start menu and searching for Internet Information Services(IIS), and open 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.

Open Internet Information Services
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 Dashboard
Internet Information Services Manager(IIS)

3. Once the root directory is open, we can create a folder for our ASP.NET directory location. wwwroot is the default IIS directory, but if you want to select a different location, you can specify it later after we are done creating the build files for our ASP.NET MVC Application. In this tutorial, this is the directory that I use. wwwroot » MySites.

www root directory
wwwroot directory

IV. Publish Your ASP.NET Web Application

To deploy a web application, you need to have a fully functional ASP.NET web application ready. This includes creating the application, developing its features, and thoroughly testing it to ensure it functions as intended.

1. Create a build file for our sample ASP.NET App. In my case I just picked up a random project I created from my previous tutorial, you may check out this link for a sample ASP.NET App “Login App using Form Authentication in ASP.NET MVC“. You may also create a new project just to test IIS deployment.

This is what my sample Web Application looks like.

ASP.NET website » how to deploy asp.net web application in iis
My Site

2. Open your project in Visual Studio and navigate to the solution explorer. Right-click on your project name and select publish.

deploy asp.net web application in iis
Publish

3. In the Publish Web Window choose Profile and create a name for your publish profile.

Create or Choose deployment profile
New Profile

4. 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 published profile name. Then press “OK”.

how to deploy asp.net web application in iis
Name your profile

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

how to deploy asp.net web application in iis
Publish Method

6. 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 » how to deploy asp.net web application in iis
Select Directory

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

Publish button » how to deploy asp.net web application in iis
Publish Option

8. 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 - how to deploy asp.net web application in iis
Successfully Published

V. Convert your website to an Application

Navigate back to your IIS Manager and go 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 - how to deploy asp.net web application in iis
Open IIS Manager

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

Manage Application - how to deploy asp.net web application in iis
IIS Manager

The browser will pop up and display your deployed ASP.NET Application. See the image below.

Localhost  - how to deploy asp.net web application in iis
My Sites

You may also access your websites using your local IP ex. http://192.168.1.2/MySites

Ip location - how to deploy asp.net web application in iis

Summary

In this tutorial, we have learned how to deploy ASP.NET web application in IIS on a Windows Machine. We also learned how we can enable and configure IIS on Windows 10. If you want to share your website with your team on your local network you can visit this article to learn how you can configure IIS to use your local IP address Deploy and Share ASP NET Core WebApp to a Local Network using IIS

That’s it you have successfully published your website into IIS. Hopefully, this article will give you an idea and can be used with your future project.

Follow us on Facebook.

KEEP CODING!