9/26/2019 Admin

Deploying A Server Side Blazor Application To Azure


image

Microsoft Azure is a cloud service provider that allows you to deploy your Blazor application to be used by anyone in the world.

image

If you don’t have a Microsoft Azure account, you can sign up for one here:

https://azure.microsoft.com/en-us/free

Create The Blazor Application

image

Open Visual Studio.

image

Select Create a new Project.

image

Select Blazor App and click Next.

image

Give it a name and click Create.

image

Select Blazor Server App and click Create.

image

The application will open in Visual Studio.

Publish To Azure

image

Right-click on the project node and select Publish.

image

When the publishing wizard comes up, select Advanced.

image

Select Self-Contained for Deployment Mode and win-x86 for Target Runtime and click Save.

(Note: Once .Net Core 3.0 is enabled on Azure, this step will no longer be required)

image

Back on the publishing wizard, select App Service, Create New, and click the Publish button.

image

Fill out the information for your App Service, and click Create.

(If you need assistance with the settings see: Publish a Web app to Azure App Service using Visual Studio )

image

The application will start deployment

image

The output window will display the progress and indicate when it is done.

image

A web browser window will open and display the deployed application.

image

Logging into Portal.Azure.com in your web browser, will allow you to administer the application.

image

For best performance, you will want to go into the Configuration for your App Service and select Configuration then General Settings

image

… and turn on Web sockets and click Save.

However, you will find that as more users use your Blazor application, the response time will slow.

To handle a large number of users, it is recommended that you use an Azure SignalR server.

See: Connecting Blazor to Azure SignalR Service (updated to Preview 4)

Special Thanks

Special thanks to Anthony Chu for Azure performance guidance.

Links

Blazor.net

Deploy ASP.NET Core 3 Previews to Azure App Service

What is Azure

Publish a Web app to Azure App Service using Visual Studio

Connecting Blazor to Azure SignalR Service (updated to Preview 4)

An error has occurred. This application may no longer respond until reloaded. Reload 🗙