Skip to content

Deploying Blazor Applications

Blazor Server Deployment

  • Deploy to ASP.NET Core capable servers
  • Configure SignalR settings
  • Set up connection management
  • Enable compression
xml
<PropertyGroup>
    <TargetFramework>net7.0</TargetFramework>
    <RuntimeIdentifier>linux-x64</RuntimeIdentifier>
    <PublishSingleFile>true</PublishSingleFile>
</PropertyGroup>

Blazor WebAssembly Deployment

  • Deploy to static file hosts
  • Configure base path
  • Enable compression
  • Set up routing rules
bash
dotnet publish -c Release

Configuration

json
{
  "DetailedErrors": true,
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*"
}

Azure Deployment

yaml
# azure-pipelines.yml
trigger:
- main

pool:
  vmImage: 'ubuntu-latest'

steps:
- task: DotNetCoreCLI@2
  inputs:
    command: 'publish'
    publishWebProjects: true

Docker Deployment

dockerfile
FROM mcr.microsoft.com/dotnet/aspnet:7.0
WORKDIR /app
COPY bin/Release/net7.0/publish .
ENTRYPOINT ["dotnet", "MyBlazorApp.dll"]