Development and production

How your ASP.NET Core app serves a Bevel site live, when it renders pages and when it serves exported files, and how to change that.

On this page
Program.cscsharp
builder.AddBevel(options => options.IsDevelopment = null);   // the default

This page applies when your ASP.NET Core app serves the site. On a pure static host (GitHub Pages, Netlify, S3, Azure Static Web Apps or any web server), Bevel does not run. The host serves the exported files, so there is no verified-file serving and no live fallback.

BevelOptions.IsDevelopment decides how the app answers pages. Bevel resolves it once at startup.

IsDevelopment Development environment Any other environment
null (default) Renders live. Serves the exported file, inside the endpoint.
true Renders live. Renders live.
false Serves exported files. Serves exported files.

The default is production-first. A forgotten setting never deploys development behavior.

Diagram: when an ASP.NET Core app serves the site, Development renders pages live. In other environments Bevel serves the exported file when it matches its recorded hash, and renders live with a warning when the file is missing or changed. On a static host, the host serves the files and handles fallbacks.

How exported files are served

  • Bevel endpoints win over files in wwwroot. Bevel hides the files at the URLs it serves, so UseStaticFiles() never answers a Bevel URL directly. That would skip authorization, CORS and caching. /index.html, <route>/index.html and <route>.html are served by the endpoint, with your conventions. A route with a bare parameter tail, such as /{Section}/{Slug}, yields to a real file with an extension unless the route has an access guard. See Authorization and exports.
  • Only files listed in .bevel-output.json with a matching SHA-256 are used.
  • Bevel caches pages up to 1 MB in memory (64 MB total, least recently used evicted first). Replacing an exported file on disk without re-exporting has no effect on cached pages. Re-export instead of copying files over.
  • Responses carry the exported Content-Type and status code, ETag and Last-Modified. They answer 304 to conditional requests and support HEAD.
  • If the manifest, file or hash does not match, the page renders live and logs a warning once per route. Files outside the web root (a custom OutputPath) are never served.
  • Endpoint filters run before Bevel serves a file or renders a page, in both modes. A filter that denies the request wins.

Handler routes

Routes made with MapStatic(pattern, handler) (RSS, sitemaps, JSON) follow the same rules. In Production, Bevel serves the verified file with its recorded Content-Type and status, and your handler does not run. Bevel appends one endpoint filter after all conventions, so your filters, authorization, CORS and output caching run first. In Development, or when the file is missing or modified, the handler runs live and keeps its normal parameter binding.

Routes marked .ExcludeFromStaticExport() and plain app.MapGet endpoints always run live. They are not served from the export.

Status-code pages

app.UseStatusCodePagesWithReExecute("/404.html") with app.MapStatic<NotFoundPage>("/404.html") renders the page and keeps the original status.

Data built for Development

The generated data records the environment build-time code ran under. If you export data built for Development (a Debug build is Development), Bevel logs a warning. Content meant only for Development, such as drafts, may be included. It is a warning, not an error.

Build with -c Release, or set ASPNETCORE_ENVIRONMENT=Production, to export production data. See Build environment.

Deployment flow

  1. Export, then publish the web root with the files in it: run dotnet run -- --bevel-build then dotnet publish, or set <BevelExportOnPublish>true</BevelExportOnPublish>.
  2. Run the published app as is.

Routes that need authorization are not exported unless you call AllowStaticExport(), so they keep rendering live.

For a pure static host, upload the exported directory. Set up 404 pages, fallbacks and redirects in the host's settings.