Service type
ASP.NET Core service
ASP.NET Core runtime service for building .NET web apps and APIs from source, with optional database, cache, and email links.
Use it as a versioned stack building block that can build from source, plug into CI/CD, and connect to external providers without hardcoding secrets into the codebase.
Why teams use this service
Technical profile
Review versions, ports, source, and packaging.
Stacks that use it
See where this service fits in ready-made stacks.
Source builds and CI/CD
Start from a compatible boilerplate, use Wodby CI, and publish images cleanly.
Runtime wiring and defaults
See ports, links, storage, configs, and runtime behavior.
On Wodby
How ASP.NET Core runs on Wodby
Build and start
The service's Dockerfile publishes the repository with the .NET SDK and runs the result on the service image:
- it picks the project: the
DOTNET_PROJECTbuild argument, or else the only project file (*.csproj,*.fsproj,*.vbproj) at the repository's root, or else the only one in asrc/<name>/directory. Among several, it takes the only runnable one: aMicrosoft.NET.Sdk.WeborMicrosoft.NET.Sdk.Workerproject, or one with<OutputType>Exe</OutputType>. Otherwise the build fails; - runs
dotnet publish -c Releasefor it, withRestoreLockedModewhen the repository has apackages.lock.json; - copies the output to
/usr/src/appin the service image, which has the ASP.NET Core runtime but no SDK.
The container starts dotnet-app, which runs the assembly named by DOTNET_APP, or else the one whose *.runtimeconfig.json is the only one in /usr/src/app. The build stage uses the newest .NET SDK, which also builds projects for earlier .NET versions; the project's TargetFramework must match the service's .NET version. A pipeline that passes a Dockerfile from the repository (wodby ci build dotnet -f Dockerfile) uses that file instead; its final stage must be FROM ${WODBY_BASE_IMAGE}.
- The application must listen on port 8080, on all interfaces. That is the port of the service's HTTP endpoint and the image's
ASPNETCORE_HTTP_PORTS, which ASP.NET Core reads. Do not set URLs inlaunchSettings.jsonor code for deployed environments:launchSettings.jsonis not used by a published application. - The service is ready once the port accepts connections.
DOTNET_ENVIRONMENTisDevelopmentin development environments and unset elsewhere, so applications run asProduction.- The image has ICU and full culture data; globalization-invariant mode is off.
- The service declares no volume of its own: files written inside the container are lost when it is replaced. That includes ASP.NET Core Data Protection keys, which by default live in the container's home: cookies and antiforgery tokens stop being valid after a deployment and differ between replicas. Persist the keys to Redis or a database when the application uses them.
Linked services
Links to other services reach the application as environment variables. Nothing in the image reads them: the application reads them itself, for example with NpgsqlConnectionStringBuilder or MySqlConnectionStringBuilder, which quote values correctly. Do not hardcode hosts or credentials.
| Link | Variables |
|---|---|
| Database (MariaDB, MySQL or PostgreSQL) | DB_HOST, DB_PORT, DB_NAME, DB_USERNAME, DB_PASSWORD, DB_DRIVER |
SMTP_HOST, SMTP_PORT | |
| Redis or Valkey | REDIS_HOST, REDIS_PORT, REDIS_PASSWORD |
| OpenTelemetry Collector | OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_PROTOCOL (http/protobuf), OTEL_EXPORTER_OTLP_HEADERS (the Collector's ingest token) |
All links are optional. A variable is present only while its link exists and the linked service is enabled. The mail link carries no credentials. The OpenTelemetry variables are the standard SDK settings: an application or agent that uses an OpenTelemetry SDK exports to the Collector without further configuration; set OTEL_SERVICE_NAME to name the application in traces.
Environment
WODBY_HOSTSis a JSON array of the environment's hosts, not a comma-separated string.WODBY_PRIMARY_HOSTandWODBY_PRIMARY_URLare the canonical ones for links generated outside a request.WODBY_APP_SERVICE_NAMEis this service's host name inside the environment. Other services reach the application at that name on port 8080.WODBY_ENV_TYPEtells a development environment from a production-like one.- Requests arrive through Wodby's gateway, which sets
X-Forwarded-ForandX-Forwarded-Proto.
In a development workspace
- The checkout is mounted at
/usr/src/appand the container runs the project withdotnet watch. A change is applied to the running application with Hot Reload, or the application is rebuilt and restarted when it can't be applied, in the same container, usually within a few seconds. Nothing has to be restarted or deployed for a code change. A build that fails leaves the running application up; the compiler's errors are in the service's logs. - The project is chosen as in the build;
WORKSPACE_DOTNET_PROJECTon the service selects another one, such assrc/Api/Api.csproj.WORKSPACE_DOTNET_COMMANDreplaces the start command. - Workspace setup restores dependencies with
workspace-dotnet prepare: the solution's when there is exactly one*.slnor*.slnxat the root, otherwise the project's, and the local tools of.config/dotnet-tools.json. With apackages.lock.json, restores fail instead of rewriting it. DOTNET_ENVIRONMENTisDevelopmentunless the service sets it, andlaunchSettings.jsonis not used. Browser refresh is off: reload the page by hand.- NuGet packages are kept in
.wodby-workspace/nugetin the checkout..wodby-workspace/,bin/andobj/are kept out of Git status without touching.gitignore. - A change to variables or linked services still needs a deployment of the environment.
Check the result
curl -s -o /dev/null -w '%{http_code}' localhost:8080from the container shows whether the application answers on the expected port.dotnet buildin the checkout shows compile errors at once; the service's logs show them too when a change does not appear.
ASP.NET Core on Wodby
This service is the .NET service with settings for ASP.NET Core applications. Everything in the .NET service's guidance applies: the build, port 8080, linked-service variables, Data Protection keys and the development workspace.
What this service adds
ASPNETCORE_FORWARDEDHEADERS_ENABLEDistrue. ASP.NET Core then applies theX-Forwarded-ForandX-Forwarded-Protoheaders that Wodby's gateway sets, soHttpContext.Request.Schemeishttpsfor visitors on HTTPS, generated links and redirects use it, andConnection.RemoteIpAddressis the visitor's address. Do not addUseForwardedHeaderswith other settings, and do not addUseHttpsRedirection: TLS ends at the gateway, and checks inside the environment use plain HTTP.- The ASP.NET Core boilerplate, which restricts host names to
WODBY_HOSTS, the app service's name andlocalhost, and answers/healthz.
Environment
ASPNETCORE_ENVIRONMENTis not set; ASP.NET Core falls back toDOTNET_ENVIRONMENT, which isDevelopmentin development environments. Elsewhere the application runs asProduction, soappsettings.Production.jsonapplies and the developer exception page is off.- Configuration from environment variables uses
__for nesting: a variable on the service namedConnectionStrings__DefaultisGetConnectionString("Default").
Check the result
curl -s -H "Host: $WODBY_APP_SERVICE_NAME" localhost:8080/healthzin the container answersHealthywhen the application uses the boilerplate's health check.- A
400 Bad Requestwith an empty body for a domain usually means host filtering does not allow it: compare the domain withWODBY_HOSTSandAllowedHosts.
Overview
Technical profile and packaging
Versions
Built on top
Source repository
Public Helm chart
Ports and protocols
Labels
Stacks
Use it inside ready-made stacks or your own
CI/CD
Build from source and ship changes without extra glue work
ASP.NET Core boilerplate
Start from a working boilerplate instead of wiring the build process from scratch.
wodby/aspnetcore-boilerplateGit providers
Connect repositories from supported Git providers when this service should build from your own codebase.
CI providers
Wodby CI is the default path, but external CI providers can fit the same build and release workflow when that suits your team better.
Container registries
Keep built images in Wodby Registry by default or store them in another registry without changing how the service is built.
Keep secrets and variables outside the codebase
Attach provider credentials and environment variables at the platform level so the build and runtime do not depend on hardcoded secrets.
Runtime wiring
Reuse connectivity, storage, and runtime defaults
Endpoints
Technical domains
Service links
These links define which other services can connect to ASP.NET Core when it is used inside a stack.
db
Eligible linked services
sendmail
Eligible linked services
redis
Eligible linked services
otel
Eligible linked services