升级到预览版 6 后,Blazor 子应用程序出现 404 错误 [英] Blazor sub app 404 error after upgrade to Preview 6

查看:30
本文介绍了升级到预览版 6 后,Blazor 子应用程序出现 404 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Blazor Preview 5(.Net Core 托管)中,我已经成功地将该应用程序配置为 Asp.net Core 站点上的子应用程序:

In Blazor Preview 5 (.Net Core Hosted), I have successfully configured the app as a sub app on the Asp.net Core site using:

app.UseRouting();

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

app.UseMvcWithDefaultRoute();

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

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

I am now trying to upgrade to Preview 6, but when the app loads I get a 404 error "Failed to load resource: the server responded with a status of 404 (Not Found)"

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

THe URL being looked for is - http://localhost:52112/superadmin/_framework/blazor.webassembly.js

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

I have tried the instructions at the following link, and variations of the same, but can't get past the error.

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

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

Can anyone advise how to get past this error?

谢谢

标记

推荐答案

看起来您的应用程序仍然引用了 .NET Core Preview 5,因为 UseBlazor 现在已经消失了.

Looks like your application still has references to .NET Core Preview 5, since UseBlazor is gone now.

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>();
});

这篇关于升级到预览版 6 后,Blazor 子应用程序出现 404 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆