Mark Shortt
Mark Shortt

Reputation: 115

Blazor sub app 404 error after upgrade to Preview 6

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

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)"

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?

Thanks

Mark

Upvotes: 4

Views: 4469

Answers (1)

codevision
codevision

Reputation: 5520

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

Upvotes: 4

Related Questions