Blazor Server App Cannot find the fallback endpoint specified by route values

发布时间 2023-10-12 09:29:19作者: 踏平扶桑

github官方issues中提到的解决方案,CreateBuilder时指定项目绝对路径可以解决。

1 // 指定项目路径,也可以用Assembly.GetCallingAssembly获取
2 const string ContentRootPath = @"C:\Users\BlazorServer"; // 项目的路径
3 const string ApplicationName = nameof(BlazorServer);
4 var builder = WebApplication.CreateBuilder(new WebApplicationOptions() { ContentRootPath = ContentRootPath, ApplicationName = ApplicationName });