I experience some strange behaviour. When using the standard ASP .NET 8 (or .NET 7) Web App template, the template does not render (or the route is not recognized) unless I use RuntimeCompilation - and I don't want to.
In the browser I'm presented with the standard 404 error page in Chrome.
The middleware pipeline seems fine
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
// Working
// -----------------------------------------------
builder.Services.AddRazorPages().AddRazorRuntimeCompilation();
// Not Working
// -----------------------------------------------
builder.Services.AddRazorPages();
WebApplication app = builder.Build();
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapRazorPages();
app.Run();
I'm using .NET 8 preview 6