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

查看:357
本文介绍了升级到预览版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>(); });

我现在正在尝试升级到Preview 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

我尝试了以下链接中的说明,以及相同的变化形式,但无法克服该错误。

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天全站免登陆