Skip to content

Hello .NET

A minimal ASP.NET Minimal API application in C#. Multi-stage Docker build with .NET SDK and ASP.NET runtime. One container, one service, no database, no cache.

Overview

Repository git@gitlab.com:appmecca-sample-apps/hello-dotnet.git
Tech Stack .NET 9 / ASP.NET Minimal API
Services web (port 8080)
Database None
Cache None
URL Pattern https://hello-dotnet-web.{env}.appmecca.net

What This App Demonstrates

  • Deploying a C# / .NET application on AppMecca
  • Multi-stage Docker build (.NET SDK + ASP.NET runtime)
  • ASP.NET Minimal APIs (simplest .NET web pattern)
  • Health check endpoint pattern

appmecca.yaml

containers:
  - name: hello-dotnet
    dockerfile: Dockerfile
    context: .

deploy:
  - name: web
    container: hello-dotnet
    port: 8080
    health_check:
      path: /health

The configuration is identical in structure to any other single-container app. ASP.NET is configured to listen on port 8080.

Step-by-Step Deployment

1. Register the app

mecca register git@gitlab.com:appmecca-sample-apps/hello-dotnet.git -e dev

2. Build the container

mecca build trigger -e dev -g git@gitlab.com:appmecca-sample-apps/hello-dotnet.git
Expected output
Build started: build-xxxxxxxx
Cloning repository...
Building container: hello-dotnet
Pushing image to the private registry: hello-dotnet/web
Build complete. Duration: 65s

3. Deploy

mecca app deploy -e dev hello-dotnet
Expected output
Deploying hello-dotnet to dev...
Deployment queued: deploy-xxxxxxxx
Waiting for agents...
Container started: hello-dotnet-web
Health check passed: /health -> 200 OK
Deployment complete.

Services:
  web: https://hello-dotnet-web.dev.appmecca.net

4. Verify

mecca app show hello-dotnet -e dev

Test the endpoint:

curl https://hello-dotnet-web.dev.appmecca.net/health
{"status": "healthy"}

Key Concepts

Multi-stage Docker builds for .NET

The first stage uses the .NET SDK to restore packages, compile, and publish the application. The second stage uses the ASP.NET runtime image (Alpine-based), which is much smaller. The final image contains only the compiled DLLs and the runtime.

ASP.NET Minimal APIs

Minimal APIs are the lightest way to build HTTP services in .NET. The entire application is defined in a single Program.cs file -- no controllers, no startup classes, just inline route handlers. This makes them ideal for microservices.

Any language, same workflow

AppMecca does not care what language your application is written in. As long as your container listens on the declared port and responds to health checks, the deployment workflow is identical.

What's Next?