Accessing .NET Core Settings
- Log in to Plesk
- Go to Websites & Domains
- Select your domain
- Click .NET Core or ASP.NET Core
Application Settings
Application Root
The directory containing your published .NET 9 application files.
Example: /httpdocs or /httpdocs/myapp
Document Root
The directory for static files. Usually the same as Application Root.
Application Startup File
Your main DLL file (e.g., MyWebApp.dll)
Environment Variables
Set environment variables in Plesk .NET Core settings:
Common Variables:
| Variable | Value | Purpose |
|---|---|---|
| ASPNETCORE_ENVIRONMENT | Production | Set app environment |
| ASPNETCORE_URLS | http://localhost:5000 | Listening URL |
| DOTNET_PRINT_TELEMETRY_MESSAGE | false | Disable telemetry messages |
Connection Strings via Environment:
ConnectionStrings__DefaultConnection=Server=localhost;Database=mydb;User Id=user;Password=pass;TrustServerCertificate=True;
Note: Use double underscore (__) for nested configuration.
appsettings.json Configuration
Production Settings:
Create appsettings.Production.json for production-specific settings:
{
"Logging": {
"LogLevel": {
"Default": "Warning",
"Microsoft.AspNetCore": "Warning"
}
},
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Database=mydb;..."
},
"AllowedHosts": "yourdomain.com"
}
Configuration Priority (highest to lowest):
- Environment variables (set in Plesk)
- appsettings.{Environment}.json
- appsettings.json
Logging Configuration
Enable Detailed Logging (temporarily):
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"Microsoft.EntityFrameworkCore": "Information"
}
}
}
View Logs in Plesk:
- Go to .NET Core settings
- Look for View Logs or stdout Logs
Kestrel Configuration
Configure Kestrel web server in appsettings.json:
{
"Kestrel": {
"Limits": {
"MaxRequestBodySize": 52428800
}
}
}
CORS Configuration
In Program.cs:
builder.Services.AddCors(options =>
{
options.AddDefaultPolicy(policy =>
{
policy.WithOrigins("https://yourdomain.com")
.AllowAnyHeader()
.AllowAnyMethod();
});
});
// In middleware
app.UseCors();
Restarting Your Application
After configuration changes:
- Go to Websites & Domains → your domain
- Click .NET Core
- Click Restart
Troubleshooting Configuration
App Not Reading Settings:
- Verify JSON syntax is valid
- Check file is in publish output
- Restart application after changes
Environment Variables Not Working:
- Use correct format with double underscore
- Restart application after adding
- Check for typos in variable names