Cannot find the fallback endpoint specified by route values: { page: /_Host, area: }

馋奶兔 提交于 2020-12-06 06:34:28

问题


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?


回答1:


  1. Make sure that you have <base href="~/" /> declaration inside the <head /> tag in your _Host.cshtml file.
  2. Make sure to specify services.Configure<RazorPagesOptions>(options => options.RootDirectory = "/Pages"); inside ConfigureServices(IServiceCollection services) method in Startup.cs file if you customised your Pages location.
  3. Try to remove endpoints.MapDefaultControllerRoute(); and check if it interferes with your routing.
  4. Try to place your _Host.cshtml file inside the RootDirectory of your pages.
  5. Verify that you have @page "/" and @namespace <MatchingYourRootPagesDir> specified on the top of _Host.cshtml file.


来源:https://stackoverflow.com/questions/58874883/cannot-find-the-fallback-endpoint-specified-by-route-values-page-host-are

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!