应用程序无法获取blazorclasslib页面

时间:2020-03-26 21:40:12

标签: asp.net-core razor blazor

我正在使用razor class library包含我的_Host.cshtml视图:

-WebApp
 -Program.cs
 -Startup.cs
-MyRazorClassLib
 -Pages
  -_Host.cshtml

并在我的webapp中添加应用程序部件,如下所示:

            services.AddRazorPages()
                    .ConfigureApplicationPartManager(p =>
                    {
                        foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
                        {
                            p.ApplicationParts.Add(new AssemblyPart(assembly));
                        }
                    });

razorclasslib程序集已添加到应用程序部件中,但我有:

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

我想念/发短信吗?

提前谢谢。

1 个答案:

答案 0 :(得分:0)

似乎是,并记录在Discovery in Application Parts

applicationName设置需要设置为用于发现的根程序集。用于发现的根程序集通常是入口点程序集。

例如:

public void Configure(IApplicationBuilder app, IWebHostEnvironment env) {
     /* set the name of the assembly containing the _Host.cshtml */
     env.ApplicationName = "myAppName";

}