PreviewDrop for .NET
Deploy previews for ASP.NET Core apps
Push a branch, get a live preview URL. PreviewDrop publishes your app, runs it on Kestrel, and posts the link to the pull request, usually within a couple of minutes.
TL;DR
Connect your repo, push. PreviewDrop detects .NET, 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.What the build needs to do
You don't write this. PreviewDrop detects .NETfrom your repo and builds the container for you — a Dockerfile in your repo is not used. The reference below shows the install, build and start steps a working .NET image needs. If detection gets one wrong, set the matching Install, Build or Start command in Project Settings. Your app must listen on $PORT.
Reference (not read by PreviewDrop)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.
| Variable | Example value | Note |
|---|---|---|
| ASPNETCORE_ENVIRONMENT | Development | Or a custom "Preview" environment — enables developer-friendly diagnostics. |
| ConnectionStrings__Default | Host=host;Database=db;Username=user;Password=pass | Double underscore maps to the nested ConnectionStrings:Default config key. |
| PORT | 8080 | PreviewDrop injects this; pass it to Kestrel via --urls or ASPNETCORE_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 reference Start command) or set ASPNETCORE_URLS. Use plain HTTP — TLS is terminated at the edge.Start the right assembly
The reference Start command 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. If a solution has several projects and the wrong one starts, set the Start command in Project Settings.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.Multi-project solutions
The reference build above restores from a single
*.csproj. For multi-project solutions, set the Build command to dotnet publish your web project (or the .sln) explicitly.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