asp.net-core - 升级到预览版 6 后 Blazor 子应用程序 404 错误

标签 asp.net-core .net-core blazor blazor-server-side

在 Blazor Preview 5 (.Net Core Hosted) 中,我使用以下命令成功地将该应用程序配置为 Asp.net Core 站点上的子应用程序:

app.UseRouting();

app.UseEndpoints(endpoints =>
{
    endpoints.MapDefaultControllerRoute();
    endpoints.MapRazorPages();
});

app.UseMvcWithDefaultRoute();

app.Map("/superadmin", child => { 
child.UseBlazor<BlazorCoreHosted.SuperAdmin.Startup>(); });

我现在正在尝试升级到预览版 6,但是当应用程序加载时,我收到 404 错误“加载资源失败:服务器响应状态为 404(未找到)”

正在寻找的 URL 是 - http://localhost:52112/superadmin/_framework/blazor.webassembly.js

我已经尝试了以下链接中的说明以及相同的变体,但无法克服错误。

https://devblogs.microsoft.com/aspnet/asp-net-core-and-blazor-updates-in-net-core-3-0-preview-6/

谁能建议如何克服这个错误?

谢谢

标记

最佳答案

看起来您的应用程序仍然引用了 .NET Core Preview 5,因为 UseBlazor现在不见了。

app.UseRouting();

app.UseEndpoints(endpoints =>
{
    endpoints.MapDefaultControllerRoute();
    endpoints.MapRazorPages();
});
app.Map("/superadmin", child =>
{
    child.UseRouting();
    child.UseEndpoints(endpoints =>
    {
        endpoints.MapFallbackToClientSideBlazor<Client.Startup>("index.html");
    });
    child.UseClientSideBlazorFiles<Client.Startup>();
});
app.Map("/superadmin2", child =>
{
    child.UseRouting();
    child.UseEndpoints(endpoints =>
    {
        endpoints.MapFallbackToClientSideBlazor<Client2.Startup>("index.html");
    });
    child.UseClientSideBlazorFiles<Client2.Startup>();
});

关于asp.net-core - 升级到预览版 6 后 Blazor 子应用程序 404 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56586677/

相关文章:

c# - aspnet-core-ad-authentication 项目 HTTP 错误 502.5 - 进程失败

asp.net - 如何将我现有的.net项目升级到asp.net core 1.0?

.net-core - VSTS - Azure DevOps : AppSettings transformations during the release, 或多个工件

visual-studio - Blazor 调试 - IIS 不更新 wwwroot 文件

.net - 重新执行错误:退出状态1:输出:ProcessUtilityVMImage\UtilityVM:系统找不到指定的路径

elasticsearch - .net核心中如何将弹性查询聚合筛选器转换为嵌套查询

c# - 如何在 ASP.NET Core 中使用 IAsyncAuthorizationFilter 进行依赖注入(inject)

c# - Microsoft.AspNetCore.Http.HttpRequest 中的 HttpRequestBase.Files 集合的类似物是什么

c# - Blazor 应用程序应该使用什么缓存策略?

c# - 单击 NavMenu 时 Blazor 不会更新