PreviewDrop for .NET

Deploy previews for ASP.NET Core apps

Push a branch, get a live preview URL. PreviewDrop publishes your app in a multi-stage build, runs it on Kestrel, and posts the link to the pull request in under 60 seconds.

TL;DR
Add a multi-stage Dockerfile, connect your repo, push. PreviewDrop runs dotnet publish then boots your app on Kestrel behind a TLS-terminated subdomain. SignalR hubs, IHostedService background workers and EF Core connection pools all run exactly as in production.

Dockerfile

Drop this at the root of your repo. PreviewDrop picks it up on the next push and builds it into a container behind a TLS-terminated subdomain.

Dockerfile
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /src COPY *.csproj ./ RUN dotnet restore COPY . . RUN dotnet publish -c Release -o /app FROM mcr.microsoft.com/dotnet/aspnet:8.0 WORKDIR /app COPY --from=build /app . EXPOSE 8080 # Replace YourApp.dll with your project's assembly name CMD ["sh", "-c", "dotnet YourApp.dll --urls http://0.0.0.0:${PORT:-8080}"]

Environment variables

Set these in the Variables tab of your PreviewDrop project. They're encrypted at rest and injected into every preview container at start.

VariableExample valueNote
ASPNETCORE_ENVIRONMENTDevelopmentOr a custom "Preview" environment — enables developer-friendly diagnostics.
ConnectionStrings__DefaultHost=host;Database=db;Username=user;Password=passDouble underscore maps to the nested ConnectionStrings:Default config key.
PORT8080PreviewDrop injects this; the CMD passes it to Kestrel via --urls.

Common gotchas

Bind Kestrel to 0.0.0.0 and the injected PORT

Kestrel defaults to localhost:5000/5001, which the proxy can’t reach. Pass --urls http://0.0.0.0:${PORT} (as in the CMD) or set ASPNETCORE_URLS. Use plain HTTP — TLS is terminated at the edge.

Replace YourApp.dll with your assembly name

The CMD runs dotnet YourApp.dll. That filename is your .csproj name with a .dll extension — e.g. a project named Shop.Web.csproj publishes Shop.Web.dll.

Disable HTTPS redirection in previews

The edge already serves HTTPS, so app.UseHttpsRedirection() inside the container redirects to a port that isn’t listening and loops. Gate it behind if (!app.Environment.IsDevelopment()) or skip it for the preview environment.

Restore deps in their own layer

The Dockerfile copies *.csproj before the source so dotnet restore is cached across pushes that don’t change package references. For multi-project solutions, copy each project’s csproj (or the .sln) before restoring.

Why not Vercel or Netlify?

Vercel and Netlify have no .NET runtime. Serverless .NET exists on other clouds, but you lose the long-lived Kestrel server, SignalR real-time hubs, and IHostedService background workers the moment you fold the app into a per-request function. PreviewDrop runs Kestrel directly — the same container shape as production, as a per-PR preview.

Preview your .NET app in 5 minutes

Connect a repo, push a branch, get a URL. No credit card, no trial clock.

Start free