In the default Razor Pages project template, part of the code in Startup.cs that enables Razor Pages is the call to MapRazorPages() in the endpoint configuration section of Configure():
app.UseEndpoints(endpoints =>
{
endpoints.MapRazorPages();
});
The necessity of this call is confirmed in the excellent Introduction to Razor Pages in ASP.NET Core article by Rick Anderson and Ryan Nowak.
While Blazor is a different UI technology, Blazor projects are also able to expose Razor Pages endpoints. For example, a Blazor project that includes ASP.NET Identity authentication exposes the Login and LogOut pages as Razor Pages.
However, the endpoint initialization in a Blazor project that exposes Razor Pages does not appear to involve a call to MapRazorPages(). If you create a new project using the default Blazor template with individual user account authentication, then scaffold in all of the Razor Pages used by ASP.NET Identity, the endpoint initialization winds up looking like this:
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapBlazorHub();
endpoints.MapFallbackToPage("/_Host");
});
The resultant application is able to properly route requests to Razor Pages endpoints like Login.cshtml and LogOut.cshtml. How is this possible without the call to MapRazorPages()?