# ASP.NET Core hosting in 2026: how to deploy a .NET web app

> A .NET web project is recognised from its .csproj or .sln file, published with dotnet publish, and started on the port Livops assigns. A project with its own Dockerfile is built from that file instead.

Source: https://livops.dev/en/hosting/dotnet-hosting

By Livops team, the people who build and run Livops. Updated 28 November 2026.

Livops finds a .NET web project from a `.csproj` or `.sln` file. It publishes the project that uses the `Microsoft.NET.Sdk.Web` SDK as the web app, and the libraries it references come with it. Test projects in the same repository are not started.

## What runs

- build: `dotnet publish -c Release -o out`, for the web project, followed by removing the `bin` and `obj` folders
- start: the app in `out` is started with `dotnet`. Livops reads the name from `out/web.config` if it exists, otherwise from the `runtimeconfig.json` that the publish wrote.

Publishing into one folder means the start command does not need to know your project's name.

## The port

Livops sets `PORT`, and the start command makes Kestrel listen on `http://0.0.0.0:$PORT`. Do not configure Kestrel endpoints in `appsettings.json` or hard-code a port, so that the port stays under Livops' control. A fixed port makes the app unreachable.

Set the health check path to `/`, or to a page that always answers. If the check fails, the app is restarted.

## Runtime version

The app runs on the .NET version it targets. Livops sets `DOTNET_ROLL_FORWARD=LatestMajor` unless you set it yourself, so a project built for a version that is no longer installed can still start on the newest installed major version. If your project pins one exact SDK in `global.json`, Livops loosens that pin before the build.

## Environment variables

Put secrets and settings in the Variables section of the cabinet. ASP.NET Core reads them as configuration, so a variable named `ConnectionStrings__Default` maps to `ConnectionStrings:Default`. A change takes effect after a restart.

## Common mistakes

- **A fixed URL in the code.** Let Livops set the port with `PORT`.
- **Publishing the whole solution by hand.** Livops publishes the web project. If you have a tests project in the solution, it is not the one started.
- **A Dockerfile that listens on a different port.** It must listen on the value in `PORT`.
- **Secrets in `appsettings.json`.** Put them in the Variables section, and keep the file for defaults only.

## Questions

**Is an ASP.NET Core app free on Livops?**

It is a web app, a server process, so it is paid by the memory it uses. Only a site built to plain files is free.

**Which port does the app listen on?**

The port in the PORT variable that Livops sets. The server is told to listen on all addresses at that port with ASPNETCORE_URLS. Do not set your own URL in the code or in appsettings.

**What if my project has a Dockerfile?**

Then Livops builds that Dockerfile and does not use the .NET preset. Your Dockerfile must start the app on the port in PORT.

## Sources

1. [.NET — dotnet publish](https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-publish). Checked 28 November 2026.
2. [ASP.NET Core — Kestrel endpoint configuration](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel/endpoints). Checked 28 November 2026.
