A project that runs perfectly on localhost is set up for development: demo data, a known admin password, placeholder keys, sandbox payments. All of that is helpful locally and dangerous in production.
This is the checklist I ship with eCommerceMVCCore, my ASP.NET Core 10 store. Most of it applies to any ASP.NET Core app going live.
1. Change or remove the demo admin
Seeded demo accounts have published passwords. They're in the README, the docs, sometimes the live demo page. Before launch:
- Create your real admin account with a strong password.
- Delete the demo admin, or at least change its password and email.
- Turn off demo seeding in production, so a fresh database doesn't recreate it.
2. Replace the JWT signing key
If your API issues JWTs, the signing key in development config is a placeholder anyone can read. With it, anyone can mint a valid token for any user, including an admin.
Generate a long random key and keep it out of source control:
# a 64-byte random key, base64-encoded
openssl rand -base64 64
Pass it in through an environment variable (Jwt__Key), your host's secret settings, or a key vault. Never commit it.
3. Point at the production database
Set the provider and connection string through environment variables rather than editing appsettings.json:
DatabaseProvider=SqlServer
ConnectionStrings__SqlServer=Server=...;Database=...;User Id=...;Password=...;Encrypt=True
Use a database user with only the permissions the app needs. And decide how migrations run in production: at startup is fine for a single instance, but a separate deployment step is safer once you scale out.
4. Set up email
Order confirmations and status updates need a real email provider. For SendGrid, that means:
- Add your API key in the admin settings (or in configuration).
- Verify your sending domain with SPF and DKIM records. Without it, order emails land in spam.
- Set the admin notification address.
- Place one test order and check the email arrives, including on a mobile mail app.
5. Switch payments from Sandbox to Live
- Create live PayPal app credentials. Sandbox ones won't work in production, and live ones should never be used for testing.
- Flip the Sandbox / Live switch.
- Register the webhook URL for the live app and confirm verification passes.
- Make one small real purchase and refund it from the dashboard. It's the only way to know the whole loop works.
Want payments ready to switch on? The ASP.NET Core e-commerce source code has a PayPal Sandbox / Live switch and one-click refunds in the dashboard.
6. HTTPS and security headers
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}
app.UseHttpsRedirection();
Make sure ASPNETCORE_ENVIRONMENT is Production. In Development, the detailed error page shows stack traces and configuration details to anyone who triggers an error.
7. Persist Data Protection keys
ASP.NET Core encrypts login cookies and antiforgery tokens with Data Protection keys. In containers or on hosts that reset the file system, the keys vanish on restart and everyone is logged out, or worse, forms start failing. Store them somewhere durable:
builder.Services.AddDataProtection()
.PersistKeysToFileSystem(new DirectoryInfo("/keys")) // a mounted volume
.SetApplicationName("my-store");
8. Logging and backups
- Send logs somewhere you can search: Application Insights, Seq, or your host's log stream. You'll want them the first time a customer says "my order disappeared".
- Turn on automated database backups, and test a restore once. A backup you've never restored is a hope, not a backup.
9. Replace the demo content
Demo products, sample prices, placeholder contact details, the default store name and logo, and the terms and privacy pages. It's easy to miss one, so click through every footer link before launch.
Print it, tick it
None of these steps takes long. Missing one can cost far more than the time it would have taken.
FAQ
How do I deploy an ASP.NET Core app to production?
Publish a Release build, set ASPNETCORE_ENVIRONMENT to Production, pass secrets through environment variables, enable HTTPS, apply migrations and set up logging. Azure App Service, a Linux server behind Nginx, and Docker all work. eCommerceMVCCore comes with documentation that walks through these steps.
Why are users logged out after every deployment?
The Data Protection keys aren't persisted, so each new instance creates new keys and old cookies can't be read. Store the keys on a mounted volume, in blob storage or in a database.
Is it safe to run with ASPNETCORE_ENVIRONMENT=Development?
No. The developer exception page shows stack traces and configuration details to anyone who triggers an error.
Get the source code
A go-live checklist with step-by-step instructions is part of the documentation for eCommerceMVCCore. Get the ASP.NET Core 10 e-commerce source code and docs.
What's on your go-live list that isn't on mine? Add it in the comments.
Top comments (0)