Place apps created in Blazor WebAssembly in IIS

Page creation date :


Visual Studio
  • Visual Studio 2019
  • .NET 5.0
Internet Information Service (IIS)
  • IIS 10
  • other
Deployed to Windows Server
  • Windows Server 2019
  • other

At first

Because the Blazor WebAssembly application is a client technology, it can be deployed to a web server other than IIS, but this time we'll show you how to publish the project directly to IIS. Basically, ASP.NET's almost the same as publishing a Core project, so let's focus on the differences.

Windows Server Setup

Suppose you have Windows Server installed.

It doesn't matter if the version is a little old.

IIS Setup

Details are also described on the following page, so I will not discuss the details.

Start Server Manager from the Start menu.

From the administration menu, select Add Roles and Features.

Click Next.

Click Next.

Click Next.

Select Web Server (IIS).

The following screen will be displayed, and click the "Add Function" button.

Since there is nothing to add in particular, click "Next".

Click Next.

Add a Managed Service. Required to publish directly from Visual Studio.

The following screen will be displayed, and click the "Add Function" button.

Click Install.

Started IIS Manager and verified that it contains "administrative services".

Installing Web Deploy

Required to receive a publishing program from Visual Studio.

Go to the link below.


Windows Server has only a basic 64-bit version, so download the 64-bit version.

Run on Windows Server.

Click Next.

Check "I accept the license agreement" and click "Next".

Click Full.

Click the "Install" button.

When the installation is finished, click the "Done" button.

When you open IIS Manager, you've added Delegate Management Services.

Application pool settings

Since it is for the purpose of confirming the operation, I will not change the setting in particular this time. If you want to set it, please refer to the following page.

Create a site

Use the default Web Site from the beginning to verify its operation. If you want to create separately, please refer to the following page.

Deployment user-related settings

Since it is for the purpose of checking the operation, it will be placed in a Windows account without creating any particular this time. If you want to set it, please refer to the following page.

Install URL Rewrite

The Blazor WebAssembly site redirects internally by default, so install URL Rewrite. Download the file, so if Windows Server is unable to download it due to security issues, download it on another PC in advance.

In your Web browser, visit the following sites:

Click Install this extension. (It is written as installation, but it is actually downloaded)

Run the downloaded "urlrewrite2.exe" on the server.

Install it because the Web PI starts.

Select Agree.

The Web PI is terminated.

Deploying programs from Visual Studio

Return to your work PC and launch Visual Studio to open blazor WebAssembly projects. This time, we will publish a program with a new project created.

Right-click on the project and select Publish.

Select Web Server (IIS) and click Next.

Select Web Deployment.

Type the following:

Parameter name value
server The IP address or DNS or domain name of the server that configured IIS. You can specify either the Internet or the intranet.
Site name Specifies the site name that is added to IIS.
To URL There is no problem with white space.
User name Specifies the user account on Windows Server or the user name that you created in IIS.
password Enter the authentication password for the user above.
Save password If it is troublesome to enter a password every time you publish, save it.

It is created as shown.

If you have created multiple publishing profiles, you can change them in the dropdown above, but if the name is confusing, you can do so.

Detailed settings can be changed on the edit screen.

"Settings" is selected from the left tab. You don't need to make any special changes, but change the Configuration, Target Runtime, and File Publishing Options as needed.

"Connect" is selected from the left tab. You will see what you typed first, but click on the "Verify Connection" button below.

The following dialog will be displayed when you can successfully connect to the publisher. Check Save this certificate for future sessions in Visual Studio and click the "I agree" button. If you save, this dialog will only be displayed for the first time.

If a check mark is displayed on the right side of the verification of the connection, it will be possible to connect normally.

By the way, if it fails, click the link to check the cause and take action depending on the cause.

Common causes include:

  • The user name and password are incorrect.
  • The IIS does not allow users. Once the investigation method is deployed by a Windows administrator.
  • Tcp 8172 firewall is not allowed. Clouds such as Azure do not allow it on the cloud side.
  • You do not have the Web Deployment tool installed "fully".
  • Iis is missing. Please double check this Tips.

When you're done, from Solution Explorer, click Solution → Project → Properties → PublishProfiles expand and set the issue name ". pubxml", so it opens.

Project Add and save the following code in the > PropertyGroup tag:


When you are finished, publish with the publish button.

If you publish successfully, you're done. It may fail occasionally, so in that case, please issue it again or verify the connection.

Once you've accessed it in a web browser and verified that blazor's program is working, you're done.

By the way, please note that if you install it with PWA, you must have HTTPS communication.

About installing .NET Runtime on Windows Server

Blazor WebAssembly is a client technology and does not need to be installed on the server side.

This is required for Blazor Server, another blazor mechanism.