Deploy Guide · C#

Deploy an ASP.NET Core App

Deploy .NET 8 APIs to Linux containers — no IIS required.

Overview

ASP.NET Core is a cross-platform, high-performance web framework that runs natively on Linux containers. Deploying .NET on Kubeletto means no Windows Server, no IIS, no Azure lock-in — just a standard Linux container with your Kestrel HTTP server.

Prerequisites

  • A .NET 8 ASP.NET Core project
  • appsettings.json reading from environment variables
  • A Kubeletto account

Step-by-Step Guide

Deploying ASP.NET Core to Kubeletto is done by configuring a Dockerfile, connecting your GitHub repository, and setting environment variables. Follow this step-by-step checklist to deploy your code:

  1. 1

    Create a multi-stage Dockerfile

    Use the official .NET SDK and ASP.NET Core runtime images.

    dockerfile
    FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
    WORKDIR /src
    COPY *.csproj .
    RUN dotnet restore
    COPY . .
    RUN dotnet publish -c Release -o /app/publish
    
    FROM mcr.microsoft.com/dotnet/aspnet:8.0
    WORKDIR /app
    COPY --from=build /app/publish .
    EXPOSE 8080
    ENTRYPOINT ["dotnet", "MyApi.dll"]
  2. 2

    Configure Kestrel to use PORT env var

    ASP.NET Core reads ASPNETCORE_URLS or ASPNETCORE_HTTP_PORTS automatically.

    csharp
    // Program.cs
    var port = Environment.GetEnvironmentVariable("PORT") ?? "8080";
    builder.WebHost.UseUrls($"http://0.0.0.0:{port}");
  3. 3

    Deploy

    Set connection strings and deploy.

    bash
    kubeletto env set ConnectionStrings__DefaultConnection="Server=host;Database=db;" --app dotnet-app
    kubeletto deploy --source github --repo your-org/aspnet-app --branch main

Sample Environment Variables

To configure your ASP.NET Core application, set these key-value pairs in the environment variables tab of the Kubeletto console or CLI. Ensure production secrets are flagged as write-only:

.env
ASPNETCORE_ENVIRONMENT=Production
PORT=8080
ConnectionStrings__DefaultConnection=Server=host;Database=db;User Id=user;Password=pass;
JWT_SECRET=your-secret

Related Kubeletto Features

Kubeletto offers automatic SSL certificate provisioning, zero-downtime rollbacks, and scale-to-zero autoscaling for ASP.NET Core container workloads:

PaaS Platform Comparisons

See how Kubeletto compares directly against other cloud platforms and PaaS providers when deploying C# workloads:

Frequently Asked Questions

Find direct answers to common questions about hosting, building, scaling, and managing ASP.NET Core containerized apps on Kubeletto:

Does Kubeletto support .NET gRPC services?

Yes. ASP.NET Core gRPC services (grpc-dotnet) run as standard HTTP/2 containers. Make sure your Kestrel configuration allows HTTP/2 and expose the correct port.

Can I use Entity Framework Core migrations on Kubeletto?

Run `dotnet ef database update` in your container entrypoint before starting the app. Wrap your ENTRYPOINT in a shell script that migrates then starts the API.

How do I access appsettings.json configuration?

Environment variables in Kubeletto map to ASP.NET Core configuration using double-underscore notation: ConnectionStrings__DefaultConnection sets ConnectionStrings.DefaultConnection.

Deploy your ASP.NET Core app today

Free during our active beta. No credit card required.

Start Deploying Free