How to host my asp net core site on iis in development environment without dep

Introduction

Hosting an ASP.NET Core site on IIS in a development environment without deploying it can be a useful way to test and your application before deploying it to a production environment. In this article, we will explore the steps to achieve this.

Step 1: Install the .NET Core Hosting

The step is to install the .NET Core Hosting Bundle on your development machine. This bundle includes the .NET Core Runtime and the ASP.NET Core Module for IIS. You can the latest version of the hosting bundle from the official Microsoft website.


// Example 1: Installing the .NET Core Hosting Bundle

Step 2: Create an ASP.NET Core Site

Next, you need to create an ASP.NET Core site that you want to host on IIS. You can create a new ASP.NET Core project using Studio or the .NET Core CLI. Make sure to select the appropriate template for your application, such as MVC or Web API.


// Example 2: Creating an ASP.NET Core Site

Step 3: Configure the Project Properties

Once you have created the ASP.NET Core site, you need to configure the project properties to enable hosting on IIS. Open the project properties and to the “Debug” tab. Select “IIS Express” as the launch profile and the “Enable SSL” option if required.


// Example 3:  Project Properties

Step 4: Configure IIS Express

By default, IIS Express runs on a different port than the HTTP port (80). To configure IIS Express to use the standard HTTP port, you need to modify the applicationhost. file. This file is located in the .vsconfig folder of your project.


// Example 4: Modifying applicationhost.config

Step 5: Start Debugging

Now that you have configured your ASP.NET Core site and IIS Express, you can start debugging your application. Press F5 or click the “Start Debugging” button in Visual Studio to launch the site in IIS Express. You can then test your application in a development environment without deploying it.


// Example 5: Starting Debugging

Conclusion

In this article, we have discussed how to host an ASP.NET Core site on IIS in a development environment without deploying it. By following the steps outlined above, you can easily test and debug your application before deploying it to a production environment.

Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents