EthioDeploy
DocsPricingDomainsBlogToolsChangelog
Deploy guides/ASP.NET Core

Deploy an ASP.NET Core app

Push an ASP.NET Core project and we build it with Microsoft's official .NET SDK image for your TargetFramework (net8.0 to net11.0), then run it on the ASP.NET runtime image on port 3000. No Dockerfile needed.

Last updated November 24, 2026

What we run by default
Detected by
.csproj or .sln with TargetFramework net8.0 to net11.0
Install
dotnet restore (part of dotnet publish)
Build
dotnet publish -c Release on mcr.microsoft.com/dotnet/sdk
Start
dotnet <AssemblyName>.dll on mcr.microsoft.com/dotnet/aspnet, port 3000

These run automatically, so leave the command fields blank. Only override them in Settings → Build if you need something different.

Fix this first: Turn on forwarded headers, or redirects come out as http://

HTTPS ends at our proxy, so your app sees plain HTTP. Until you add ASPNETCORE_FORWARDEDHEADERS_ENABLED=true to the project's env vars, Request.Scheme is http and OAuth callbacks and absolute links point at the wrong scheme.

How the build works

We read TargetFramework from your .csproj (or Directory.Build.props) and build with the matching official image, mcr.microsoft.com/dotnet/sdk:10.0 for net10.0. .NET 8, 9, 10 and 11 work. The build runs dotnet publish -c Release, and the app runs on the smaller aspnet image with dotnet YourApp.dll, named after the project or its AssemblyName.

With one .csproj in the repo root, that's the one we publish. With a solution file in the root, we publish the only web project it lists (the one using Microsoft.NET.Sdk.Web). If there are several, set the Root Directory to the folder of the one you want. Add a .dockerignore with bin/ and obj/ if you commit those; we leave them out either way.

Your own Dockerfile

A Dockerfile in the repo is used instead (Builder: Auto). You need one for .NET 7 or older, or for a custom build. This one matches what we generate, with MyApp.dll changed to your project's name:

FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /src
COPY *.csproj ./
RUN dotnet restore
COPY . .
RUN dotnet publish -c Release -o /app --no-restore

FROM mcr.microsoft.com/dotnet/aspnet:10.0
WORKDIR /app
COPY --from=build /app .
ENV ASPNETCORE_HTTP_PORTS=3000
EXPOSE 3000
ENTRYPOINT ["dotnet", "MyApp.dll"]

Copying the .csproj and restoring before copying the rest lets Docker reuse the restore step when only code changes. If the Dockerfile isn't in the repo root, set Dockerfile Path in Settings → Build.

Port

We send traffic to port 3000. ASP.NET Core doesn't read a PORT variable: Microsoft's container images listen on 8080 by default, and Kestrel on its own listens on localhost:5000, which nothing outside the container can reach. Our build sets ASPNETCORE_HTTP_PORTS=3000, which makes it listen on 3000 on every interface; with your own Dockerfile, set ENV ASPNETCORE_HTTP_PORTS=3000 in it. The deploy log shows Now listening on: http://[::]:3000 when it's right.

Remove any UseUrls(...) or Kestrel endpoints in appsettings.json that point elsewhere; they override the env var.

HTTPS and forwarded headers

HTTPS ends at our proxy, and the request reaches your app as plain HTTP with X-Forwarded-Proto: https. By default ASP.NET Core ignores that header, so Request.Scheme is http, redirect URLs and OAuth callbacks come out wrong, and UseHttpsRedirection can't tell the request was already HTTPS. Add one env var in the project's settings:

ASPNETCORE_FORWARDEDHEADERS_ENABLED=true

It turns on the forwarded headers middleware for proxies outside the container. You can also remove app.UseHttpsRedirection(): visitors already reach the app over HTTPS.

Health check

Every deploy requests your health check path (/ by default) and only goes live once it returns a 2xx or 3xx status. The platform keeps checking it after that. If / returns 404 or needs a login, add a route like /healthz that returns 200 and set it as the Health Check Path in Settings. Otherwise the deploy fails and the previous version keeps serving. A Web API project with no / route answers 404. ASP.NET Core's health checks give you a route in two lines:

builder.Services.AddHealthChecks();
// after builder.Build():
app.MapHealthChecks("/healthz");

Then set the Health Check Path to /healthz.

Add a database

Add a Postgres addon and DATABASE_URL is set for you as postgres://user:password@host:5432/dbname. Npgsql doesn't accept that form; passing it straight in fails with Format of the initialization string does not conform to specification. Convert it once at startup:

using Npgsql;

var builder = WebApplication.CreateBuilder(args);

var db = new Uri(Environment.GetEnvironmentVariable("DATABASE_URL")!);
var userInfo = db.UserInfo.Split(':', 2);
var connectionString = new NpgsqlConnectionStringBuilder
{
    Host = db.Host,
    Port = db.Port,
    Database = db.AbsolutePath.TrimStart('/'),
    Username = Uri.UnescapeDataString(userInfo[0]),
    Password = Uri.UnescapeDataString(userInfo[1]),
}.ConnectionString;

builder.Services.AddSingleton(NpgsqlDataSource.Create(connectionString));
// or, with EF Core:
// builder.Services.AddDbContext<AppDb>(o => o.UseNpgsql(connectionString));

The database is only reachable from the running app, not during the Docker build. Apply EF Core migrations when the app starts (for example db.Database.Migrate() in a scope after builder.Build()), or from your machine with the addon's external access turned on.

Data protection keys

Cookie authentication, Identity and antiforgery tokens are signed with data protection keys, which ASP.NET Core stores on the container's disk by default. Each deploy starts a fresh container with new keys, so everyone gets signed out and forms open before the deploy fail to submit. If you use any of these, keep the keys in the database with the Microsoft.AspNetCore.DataProtection.EntityFrameworkCore package and .PersistKeysToDbContext<AppDb>().

Which base image

Use the regular aspnet image, or aspnet:10.0-alpine for a smaller one. Avoid the -chiseled and distroless variants: the deploy runs a sh command inside the container to mark it ready, and those images have no shell, so the deploy fails.

Host an ASP.NET Core app for free

The Free plan costs nothing and needs no card. It includes:

  • One project, live over HTTPS at <project-slug>.ethiodeploy.app.
  • 256 MB of memory and half a CPU core.
  • A managed Postgres, MySQL or Redis addon with 512 MB of storage. It doesn't expire.
  • A redeploy on every push, the same as the paid plans.

The catch is sleep. After 30 minutes without traffic the app stops, and the next request starts it again. We hold that request for up to 30 seconds while the app boots, so the first visitor after a quiet spell waits a little.

ASP.NET Core is light on memory. In our test, the minimal API from dotnet new web, limited to 256 MB and half a CPU like the Free plan, used about 20 MB after 200 requests, and about 26 MB with Npgsql connected to Postgres.

When the app has to stay awake or needs your own domain, Pro is $10 or 1,399 ETB a month: always on, 1 GB of memory and a 5 GB database.

Deploy

  1. Sign in with GitHub and install the EthioDeploy app on the repo.
  2. Click “New Project” and pick the repo.
  3. Watch the build in the dashboard. When the health check passes, your app is live at <project-slug>.ethiodeploy.app. Every push to the default branch redeploys, and the old version keeps serving until the new one is healthy.

Troubleshooting

The SDK can't target net8.0 or newer, or a dotnet-sdk package isn't found+

Cause: We couldn't tell which project to build (several root .csproj files, or a solution with several web projects), or a custom Install or Build Command is set, so the build fell back to an older builder with .NET 6.

Fix: Set the Root Directory to the project's folder, clear the custom commands, or add the Dockerfile above.

Deploy fails: the app never answered on port $PORT+

Cause: The app listens on 8080 (the container image default), 5000 or localhost.

Fix: Remove UseUrls and Kestrel endpoint settings. With your own Dockerfile, set ENV ASPNETCORE_HTTP_PORTS=3000.

Redirects and OAuth callbacks use http://+

Cause: The app doesn't trust X-Forwarded-Proto from our proxy.

Fix: Add the env var ASPNETCORE_FORWARDEDHEADERS_ENABLED=true.

Format of the initialization string does not conform to specification starting at index 0+

Cause: DATABASE_URL (a postgres:// URL) was passed to Npgsql as a connection string.

Fix: Convert it with NpgsqlConnectionStringBuilder as shown above.

Users are signed out after every deploy+

Cause: Data protection keys live on the container's disk and are new in each deploy.

Fix: Persist the keys to the database with PersistKeysToDbContext.

The deploy fails right after the health check passes+

Cause: The final image is chiseled or distroless and has no /bin/sh.

Fix: Use mcr.microsoft.com/dotnet/aspnet:10.0 or its -alpine variant.

Still stuck? Check the deployment's build log in the dashboard, or see Troubleshooting.

Questions

Yes. The Free plan runs one project with 256 MB of memory and a 512 MB Postgres database. A minimal ASP.NET Core API used about 20 MB in our test. It sleeps after 30 minutes without traffic and wakes on the next request. Pro ($10/month) keeps it always on.

No, for .NET 8 to 11. We read TargetFramework from the .csproj and build with Microsoft's matching sdk and aspnet images. Use a Dockerfile for .NET 7 or older, or a custom build.

3000. Our build sets ASPNETCORE_HTTP_PORTS=3000 for you; with your own Dockerfile, set it there. ASP.NET Core doesn't read the PORT variable, and Microsoft's images default to 8080.

The addon sets DATABASE_URL as a postgres:// URL, which Npgsql doesn't accept. Parse it with Uri and build the connection string with NpgsqlConnectionStringBuilder, then pass that to NpgsqlDataSource or EF Core's UseNpgsql.

Ready to deploy?

Sign in with GitHub and pick your repo. No Dockerfile, no YAML.

More guides

Telegram botDiscord botWhatsApp bot

All guides on the deploy guides page. Custom domains, env vars, addons and billing are in the docs.

On this page
How the build worksPortHTTPS and forwarded headersHealth checkAdd a databaseData protection keysWhich base imageHost an ASP.NET Core app for freeDeployTroubleshootingQuestions
Deploying with an agent?Point it at llms.txt. Every guide is in one file there.Open llms-full.txt →
EthioDeploy

Agentic first development and deployment, started in Ethiopia, built for developers everywhere.

Telegram community
Product
PricingAI coding agentAgent mode docsDomainsCLIFree backend hostingHosting in EthiopiaChangelog
Deploy guides
Next.jsNode.jsPythonSvelteKitTanStack StartAstroNuxtReact RouterHonoStrapiPayload CMSDjangoFastAPIFlaskStreamlitExpressNestJSLaravelRailsGoSpring BootASP.NET CoreTelegram botDiscord botWhatsApp botLovableBoltReplitv0Google AI StudioBase44Firebase StudioClaude Code & Cursor
Compare
vs Herokuvs Vercelvs Rendervs Railwayvs Fly.iovs Netlifyvs KoyebHeroku alternativesVercel alternativesNetlify alternativesRender alternativesRailway alternativesFly.io alternativesReplit alternativesPythonAnywhere alternativesDigitalOcean App Platform alternativesGlitch alternatives
Resources
DocsBlogFree toolsAboutSupportContactllms.txt
© 2026 EthioDeployPay by card in USD or bank transfer in ETBTermsPrivacy