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:Running the Application
In the new application folder, execute the commanddotnet run to initiate the application:
Install Flyctl and Login
We are ready to start working with Fly.io, and that means we needflyctl, our CLI app for managing apps on Fly.io. 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 Fly.io.
Launch the app on Fly
Each Fly App needs afly.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 apps open to see your deployed app in action.
Try a few other commands:
fly logs- Tail your application logsfly status- App deployment detailsfly 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:
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 Fly.io platform.
The rest of the file contains settings to be applied to the application when it deploys.
Deploying to Fly.io
To deploy changes to your app, just run just run:fly.toml file and get the app name hellodotnet from there.
Then flyctl will start the process of deploying our application to Fly.io 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 commandfly status will give you all the essential details.
Connecting to the App
The quickest way to browse your newly deployed application is with theflyctl apps open command.
Bonus Points
If you want to know what IP addresses the app is using, tryfly ips list: