.NET apps need the Starter plan or a bigger one. See pricing.
Detected by
a .csproj file at the top of the project. The general rules are in Deploying.
Build
- .NET 8 SDK: dotnet publish -c Release for the .csproj at the top (the first by name if there are several).
- The output runs on the ASP.NET Core 8 runtime as dotnet YourProject.dll.
- Put the web project's .csproj at the top of the zip; projects it references can sit in subfolders.
Start
Always dotnet YourProject.dll. ASP.NET Core is already told to listen on PORT, so you set nothing; don't hard-code UseUrls or a port in launchSettings.json-style code.
Example
Program.cs
using Npgsql;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddNpgsqlDataSource(builder.Configuration["DATABASE_URL_NPGSQL"]!);
var app = builder.Build();
app.MapGet("/", () => new { ok = true });
app.MapGet("/orders", async (NpgsqlDataSource db) =>
{
await using var cmd = db.CreateCommand("SELECT id, total FROM orders ORDER BY id DESC LIMIT 20");
await using var r = await cmd.ExecuteReaderAsync();
var rows = new List<object>();
while (await r.ReadAsync()) rows.Add(new { id = r.GetInt64(0), total = r.GetDecimal(1) });
return rows;
});
app.Run();Frameworks
| Framework | Start command or setting |
|---|---|
| Minimal API / MVC | nothing to set |
| Blazor Server | nothing to set; WebSockets work |
Good to know
- Configuration: environment variables override
appsettings.json; use double underscores for sections,ConnectionStrings__DefaultforConnectionStrings:Default. - Behind our HTTPS proxy, add
app.UseForwardedHeaders()withXForwardedProtoso redirects and links use https. - Npgsql wants its own connection-string format (
Host=...;Port=5433;...;SSL Mode=Require); see Databases.