Application Startup Failure Diagnostics Print

  • 0

Overview

When your .NET Core or Blazor application fails to start, you typically see HTTP 500.30 or 502.5 errors. This guide provides a systematic approach to diagnosing and fixing startup failures on Plesk Windows hosting.

Step 1: Enable Detailed Errors

First, enable stdout logging to capture the actual error:

<aspNetCore processPath="dotnet" 
            arguments=".YourApp.dll" 
            stdoutLogEnabled="true" 
            stdoutLogFile=".logsstdout">
  <environmentVariables>
    <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
  </environmentVariables>
</aspNetCore>

Important: Revert ASPNETCORE_ENVIRONMENT to "Production" after debugging.

Step 2: Check stdout Logs

  1. Go to Plesk Fileshttpdocs/logs
  2. Open the most recent stdout log file
  3. Look for exception messages and stack traces

Common Startup Failures and Solutions

Missing Runtime

Error: "It was not possible to find any compatible framework version"

Solution:

  • Verify correct .NET version is selected in Plesk Hosting Settings
  • Or publish as self-contained: dotnet publish -c Release --self-contained

Missing Dependencies

Error: "Could not load file or assembly 'PackageName'"

Solution:

  • Ensure all NuGet packages are restored before publishing
  • Use self-contained deployment to include all dependencies
  • Check that the package supports your target framework

Configuration Errors

Error: "Unable to resolve service for type'...'"

Solution:

  • Review Program.cs for missing service registrations
  • Ensure all required services are registered with DI container

Database Connection Failure

Error: SqlException during startup

Solution:

  • Verify connection string in appsettings.Production.json
  • Add TrustServerCertificate=True for SQL Server
  • Ensure database user has proper permissions

Port Conflicts

Error: "Address already in use"

Solution:

  • Remove any hardcoded port bindings in Program.cs
  • Let IIS/Kestrel integration handle port assignment

Incorrect Startup DLL

Error: "The application to execute does not exist"

Solution:

  1. Go to Plesk Hosting Settings
  2. Verify Application Startup File matches your main DLL name
  3. Check the DLL exists in httpdocs folder

Step 3: Verify Published Files

Compare your local publish folder with deployed files:

dotnet publish -c Release -o ./publish
dir ./publish

Ensure all files uploaded correctly, especially:

  • YourApp.dll (main application)
  • YourApp.deps.json (dependencies)
  • YourApp.runtimeconfig.json (runtime settings)
  • web.config (IIS configuration)

Step 4: Restart Application Pool

  1. In Plesk, go to Websites & Domains
  2. Find the .NET Core section or Hosting Settings
  3. Click Restart App or recycle the Application Pool

Step 5: Test Locally

Before redeploying, test with production settings locally:

set ASPNETCORE_ENVIRONMENT=Production
dotnet run

Still Failing?

Gather this information for support:

  • Exact error message from browser
  • Contents of stdout log file
  • Your .NET version (e.g., .NET 8, .NET 9)
  • Application type (Web App, API, Blazor Server, Blazor WASM)
  • Recent changes made before the failure

Was this answer helpful?

« Back