Hasan Onat Toprak
Hasan Onat Toprak

Reputation: 61

AspCore 404 on production enviroment

When I create AspCore Hosted Blazor Wasm template project(VS22) and change server's launchSettings.json aspnetcore enviroment to "Production" or delete it entirely, page gets 404. It runs fine on "Development". Am i missing something? Do i need to configure anything else to run the app on production enviroment?

Upvotes: 5

Views: 697

Answers (1)

In my case helped adding StaticWebAssetsLoader.UseStaticWebAssets() to Program.cs in BlazorApp.Server.proj:

using Microsoft.AspNetCore.Hosting.StaticWebAssets;
...

var builder = WebApplication.CreateBuilder(args);

StaticWebAssetsLoader.UseStaticWebAssets(builder.Environment, builder.Configuration);

...

Upvotes: 3

Related Questions