Deploy a C# .NET application on onesubnet
Deploy ASP.NET / .NET services: dotnet build, run the DLL, port and environment variables.
Deploy a C# .NET application on onesubnet
onesubnet runs your .NET applications (ASP.NET Core, services, API). Deploy via Git.
1. Prepare the project
- A
.csproj/.slnat the root. - ASP.NET Core reads
ASPNETCORE_URLSorPORT. Bind the port inProgram.cs:
var port = Environment.GetEnvironmentVariable("PORT") ?? "8080";
builder.WebHost.UseUrls($"http://*:{port}");
2. Deploy
- Connect your Git repository in the panel.
- Build command:
dotnet publish -c Release -o out - Start command:
dotnet out/MyApp.dll
3. Environment variables
Connection strings, secrets… in Settings → Environment. ASP.NET reads them via IConfiguration / Environment.GetEnvironmentVariable.
4. Logs
Live console in the panel. Use ILogger (Serilog supported).
References
- .NET: https://learn.microsoft.com/dotnet/
- ASP.NET Core: https://learn.microsoft.com/aspnet/core/