I use This Project and created a project exactly like it, But receive
Cannot find the fallback endpoint specified by route values: { page: /_Host, area: }.
Error when I start the project, In the startup configure method I have:
app.UseEndpoints(endpoints =>
{
endpoints.MapBlazorHub();
endpoints.MapDefaultControllerRoute();
endpoints.MapFallbackToPage("/_Host");
});
How to resolve this error?
<base href="~/" />
declaration inside the <head />
tag in your _Host.cshtml
file.services.Configure<RazorPagesOptions>(options => options.RootDirectory = "/Pages");
inside ConfigureServices(IServiceCollection services)
method in Startup.cs
file if you customised your Pages
location.endpoints.MapDefaultControllerRoute();
and check if it interferes with your routing._Host.cshtml
file inside the RootDirectory
of your pages.@page "/"
and @namespace <MatchingYourRootPagesDir>
specified on the top of _Host.cshtml
file.If you updating project SDK to .NET 6, you can add following property into your .csproj file
<PropertyGroup>
<UseRazorSourceGenerator>false</UseRazorSourceGenerator>
</PropertyGroup>
Source: https://github.com/dotnet/aspnetcore/issues/36535#issuecomment-919861308
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With