Runway

Deploy .NET

Let’s deploy an small HTTP service written in .NET on Runway!

Setup

Create a new (web) project for your .NET app:

$ dotnet new web -o my-app

Then go into the my-app directory, initialize a git repository (git init).

The app

The Program.cs file will contain your route. Let’s also log all requests (using a middleware) and configure the webserver through a PORT environment variable (with a default of 3000):

var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();

var logger = app.Logger;

string port = Environment.GetEnvironmentVariable("PORT") ?? "3000";

// middleware
app.Use(async (context, next) =>
{
    logger.LogInformation("Request: {Method} {Path}",
        context.Request.Method,
        context.Request.Path);

    await next();
});

app.MapGet("/", () => "Hello World!");

app.Run($"http://0.0.0.0:{port}");

Pay special attention to the app.Run(), by default the project will only be available on localhost.

Now that all is configured and setup, let’s git commit and deploy!

Deploy to Runway

Create an application on Runway:

$ runway app create
INFO    checking login status                        
INFO    created app "ingenious-builder"                 
create app ingenious-builder: done
next steps:  
* commit your changes  
* runway app deploy  
* runway open

And deploy:

$ runway app deploy && runway open

Congrats, you’re dotnet app is now on Runway! ✅