Dean Leigh
06/16/2024, 5:38 PMDean Leigh
06/16/2024, 5:55 PMDean Leigh
06/16/2024, 5:56 PMpublic void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
services.AddRazorPages(); // Add this line
}
• Configure the middleware in Configure:
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
// Existing middleware configurations
app.UseEndpoints(endpoints =>
{
endpoints.MapRazorPages(); // Add this line
endpoints.MapControllers();
endpoints.MapBlazorHub();
endpoints.MapFallbackToFile("index.html");
});
}
3. Create Razor Pages: In the server project, add a new folder named Pages if it doesn't already exist, and then add your Razor Pages there. These pages will be served by the ASP.NET Core server and can coexist with the Blazor WebAssembly app.
4. Run Your Application: When you run your application, the server will be able to serve both the Razor Pages and the Blazor WebAssembly app. Requests to URLs that match Razor Pages will be handled by those pages, while other requests can fallback to the Blazor app.Dean Leigh
06/16/2024, 5:57 PMDean Leigh
06/16/2024, 5:58 PMA hub and casual space for you to interact with fellow community members and learn more about Umbraco!
Powered by