Tarek Salah
Tarek Salah

Reputation: 162

AuthenticationService.js 404 not found in Blazor Multi Application

When I try to use Authentication in my multi-WebAssembly Blazor applications, I receive the error that AuthenticationService.js is 404 not found.

The Blazor applications is working fine as the instructions here or here.

Also each Blazor application working fine if they are working from the root https://localhost even with authentication to my IdentityServer4.

Once I port them to https://localhost/FirstApp the following script is not working:

<script src="_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js"></script>

I receive the 404 not found.

I think that StaticWebAssetBasePath does not load the _cocntents as it should be.

My Question is: How to load the AuthenticationService.js when working with multiple Blazor WebAssembly application without receiving the 404 not found?

I try the answer in this link but with no luck

Edit: I have asked the same question here but with no luck.

Upvotes: 1

Views: 1037

Answers (1)

Tarek Salah
Tarek Salah

Reputation: 162

Reference to the documentation here I have to add first.UseStaticFiles("/FirstApp") after the first.UseStaticFiles() when I MapWhen the WebAssembly FirstApp. Without this line DotNet Components will not load static files such as <script src="_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js"></script> and I will receive 404 Not found for them.

Upvotes: 0

Related Questions