Run a .NET App

Getting an application running on is essentially working out how to package it as a deployable image. Once packaged, it can be deployed to the platform.

In this guide we’ll learn how to deploy a .NET application on

Generate the .NET Application

For our example, we will create a simple “hello world” application using the default web template in .NET. We assume that you have already installed .NET.

Once .NET is installed, we can create a new project by running the following command:

dotnet new web --name hellodotnet
The template "ASP.NET Core Empty" was created successfully.

Processing post-creation actions...
Restoring \hellodotnet\hellodotnet.csproj:
Determining projects to restore...
Restored \hellodotnet\hellodotnet.csproj (in 69 ms).
Restore succeeded.

Running the Application

In the new application folder, execute the command dotnet run to initiate the application:

dotnet run
Now listening on: http://localhost:5162
Application started. Press Ctrl+C to shut down.
Hosting environment: Development

This command will start the “hellodotnet” application, and you will be able to access it locally using the address provided in the output.

Now, let’s proceed to deploy this application to Fly.

Install Flyctl and Login

We are ready to start working with, and that means we need flyctl, our CLI app for managing apps on If you’ve already installed it, carry on. If not, hop over to our installation guide. Once that’s installed you’ll want to log in to

Launch the app on Fly

Each Fly App needs a fly.toml file to tell the system how we’d like to deploy it. That file can be automatically generated with the command flyctl launch command. This command will also generate a Dockerfile for deployment.

fly launch
Creating app in \fly\guides\hellodotnet
Scanning source code
Detected a .NET app
? Choose an app name (leave blank to generate one): hellodotnet
? Select Organization: demo (demo)
? Select region: ord (Chicago, Illinois (US))
App will use 'ord' region as primary
Created app 'hellodotnet' in organization 'demo'
Admin URL:
? Would you like to set up a Postgresql database now? No
? Would you like to set up an Upstash Redis database now? No
Wrote config file fly.toml
? Would you like to deploy now? Yes

Deploying hellodotnet

That’s it! Run fly apps open to see your deployed app in action.

Try a few other commands:

  • fly logs - Tail your application logs
  • fly status - App deployment details
  • fly deploy - Deploy the application after making changes

Inside fly.toml

The fly.toml file now contains a default configuration for deploying your app. In the process of creating that file, flyctl has also created a Fly-side application slot of the same name, “hellodotnet”. If we look at the fly.toml configuration file we can see the name in there:

app = "hellodotnet"
primary_region = "ord"

  internal_port = 8080
  force_https = true
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 0
  processes = ["app"]

The flyctl command will always refer to this file in the current directory if it exists, specifically for the app name/value at the start. That name will be used to identify the application to the platform.

The rest of the file contains settings to be applied to the application when it deploys.

Deploying to

To deploy changes to your app, just run just run:

fly deploy

This will lookup our fly.toml file and get the app name hellodotnet from there.

Then flyctl will start the process of deploying our application to using the Dockerfile. Flyctl will return you to the command line when it’s done.

Viewing the Deployed App

If you want to find out more about the deployment. The command fly status will give you all the essential details.

fly status
  Name     = hellodotnet
  Owner    = personal
  Hostname =
  Image    = hellodotnet:deployment-01H4MDR3GVFX20X5DNVZS4BPWK
  Platform = machines

app     91857500000083  1       ord     started         2023-07-06T01:49:28Z
app     e2865100000086  1       ord     stopped         2023-07-06T01:50:04Z

Connecting to the App

The quickest way to browse your newly deployed application is with the flyctl apps open command.

flyctl apps open

Your browser will be sent to the displayed URL.

Bonus Points

If you want to know what IP addresses the app is using, try fly ips list:

fly ips list
VERSION IP                      TYPE            REGION  CREATED AT 
v6      2a09:8280:1::69:37fd    public          global  18m55s ago
v4          public (shared)

Arrived at Destination

You have successfully built, deployed, and connected to your first .NET web application on