How to Deploy a Blazor Application on IIS


Blazor is a web framework for simplifying the development of fast single page applications, which can run in any browser. It is based on C#, Razor, and HTML.

In this article, you will learn to deploy an ASP.NET Core hosted application created with the web UI framework on IIS. You will use Visual Studio 2017 on your Windows 10 PC to publish it. You will also use SQL Server 2014 to deal with DB operations. But before discussing the steps for deployment, let’s take a look at the prerequisites.

Prerequisites

Also, take a look at this article, which shows the process of creating Cascading DropDownList in Blazor using Entity framework. You will have to take it as a reference for developing the application that will be deployed in this tutorial.

Steps for Installing .NET Core Hosting Bundle

First, you need to install .NET Core Hosting Bundle. Follow these steps:

  1. Head to the .NET Core Hosting Bundle
  2. Choose the latest non-preview .NET Core runtime.

How to Deploy a Blazor Application on IIS

  1. Click on Hosting Bundle Installer. The .NET Core Hosting Bundle will begin to be downloaded.

How to Deploy a Blazor Application on IIS

  1. Double click on the downloaded file to start the installation process.

How to Deploy a Blazor Application on IIS

When the installation is done, restart your PC.

Steps for Publishing the Blazor Application

Now, it’s time for publishing your Blazor application. Here are the steps:

  1. Open Visual Studio 2017.
  2. Open the Blazor application.
  3. Take a look at the Solution Explorer tab, which is located on the left side of the screen. Right-click on Server project of the solution, which is BlazorDDL.Server. Click on Publish.

How to Deploy a Blazor Application on IIS

  1. You will see a new screen. In the left menu, click on Folder. Choose the folder where you want your Blazor application to be published to.

How to Deploy a Blazor Application on IIS

  1. Click on Publish. If there is no error, your application will be published successfully.

Steps for Configuring IIS

Next, you will have to configure IIS. Follow these steps:

  1. Open IIS
  2. Right click on Sites. Then click on Add Website
  3. A pop-up box will appear. Enter your Site name. In this tutorial, we will use ankitsite. Insert the path to the published application in the box below Physical path. Then insert your Hostname. Here, we will use ankitsite.com

How to Deploy a Blazor Application on IIS

  1. Click OK.
  2. Now, you have to configure Application Pool. You will find it the left panel. Double click on the pool ankisite, which is the same as the Site name you entered in the 3rd step.
  3. The Edit Application Pool window will appear. From the .NET CLR Version drop-down list, choose No Managed Code option.

How to Deploy a Blazor Application on IIS

  1. Click OK.

Steps for Configuring the DNS Host

The process of configuring the DNS Host is really easy. You just need to follow these steps:

  1. Head to this path on your PC:
C:WindowsSystem32driversetc
  1. Open the hosts file with your favorite text editor.
  2. Add the hostname, which you entered in the 3rd step of Configuring IIS section, against the local IP address.

How to Deploy a Blazor Application on IIS

Steps for Executing Demo

Finally, it’s time for executing your Blazor application on localhost. Here are the steps:

  1. Open your favorite browser.
  2. Enter the configured hostname in the address bar.
  3. Hit the Enter button. Your Blazor application will appear.

Conclusion

In this article, you have learned to publish your Blazor application. You have also learned to configure IIS and DNS host appropriately.

Check out these top 3 Windows hosting services:

Was this article helpful?