Deploying Blazor Applications to Plesk Print

  • 0

Overview

This guide covers deploying Blazor Server, Blazor WebAssembly, and Blazor Web App projects to your Windows hosting account via Plesk.

Before You Begin

  • Ensure your project targets .NET 10 (or your desired .NET version)
  • Test your application locally
  • Have your Plesk login credentials ready

Publishing Your Blazor App

Using Visual Studio:

  1. Right-click your project in Solution Explorer
  2. Select Publish
  3. Choose Folder as the target
  4. Configure settings and click Publish

Using Command Line:

# For Blazor Server or Blazor Web App
dotnet publish -c Release -o ./publish

# For Blazor WebAssembly (standalone)
dotnet publish -c Release -o ./publish

Deploying Blazor Server / Blazor Web App

Step 1: Upload Files

  1. Log in to Plesk
  2. Go to Websites & DomainsFile Manager
  3. Navigate to your document root (e.g., httpdocs)
  4. Upload all files from your publish folder

Step 2: Configure .NET Core in Plesk

  1. Go to Websites & Domains → your domain
  2. Click .NET Core
  3. Set Application Root: your app folder (e.g., /httpdocs)
  4. Set Application Startup File: your main DLL (e.g., MyBlazorApp.dll)
  5. Click Enable

Deploying Blazor WebAssembly (Standalone)

Standalone Blazor WASM apps are static files and can be hosted without ASP.NET Core:

Step 1: Publish

dotnet publish -c Release

Published files are in: bin/Release/net10.0/publish/wwwroot

Step 2: Upload Static Files

  1. Upload contents of publish/wwwroot to your document root
  2. Ensure index.html is in the root folder

Step 3: Configure URL Rewriting

Create or edit web.config in your document root:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Serve subdir for root" stopProcessing="true">
          <match url=".*" />
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
          </conditions>
          <action type="Rewrite" url="index.html" />
        </rule>
      </rules>
    </rewrite>
    <staticContent>
      <remove fileExtension=".blat" />
      <remove fileExtension=".dat" />
      <remove fileExtension=".dll" />
      <remove fileExtension=".json" />
      <remove fileExtension=".wasm" />
      <remove fileExtension=".woff" />
      <remove fileExtension=".woff2" />
      <mimeMap fileExtension=".blat" mimeType="application/octet-stream" />
      <mimeMap fileExtension=".dat" mimeType="application/octet-stream" />
      <mimeMap fileExtension=".dll" mimeType="application/octet-stream" />
      <mimeMap fileExtension=".json" mimeType="application/json" />
      <mimeMap fileExtension=".wasm" mimeType="application/wasm" />
      <mimeMap fileExtension=".woff" mimeType="font/woff" />
      <mimeMap fileExtension=".woff2" mimeType="font/woff2" />
    </staticContent>
  </system.webServer>
</configuration>

Deploying Blazor WASM with ASP.NET Core Backend

  1. Publish the Server project (not the Client project)
  2. Upload all files from the publish folder
  3. Configure .NET Core in Plesk as shown above
  4. The Client files are automatically included in wwwroot

Environment Configuration

Set environment to Production in Plesk .NET Core settings:

ASPNETCORE_ENVIRONMENT=Production

Verifying Deployment

  1. Visit your domain in a browser
  2. Check browser console for errors (F12)
  3. Verify all static files load correctly
  4. Test interactive features

Was this answer helpful?

« Back