Overview
The existing solution contains:
- BethanysPieShopHRM.Api
- BethanysPieShopHRM.App
- BethanysPieShopHRM.Shared
Presently, BethanysPieShopHRM.App is a standalone Blazor WASM app.
This process converts it to a hosted Blazor WASM app.
BethanysPieShopHRM.Api
dotnet add package Microsoft.AspNetCore.Components.WebAssembly.Server
Program.cs
// ... if (app.Environment.IsDevelopment()) { app.UseWebAssemblyDebugging(); } app.UseBlazorFrameworkFiles(); // needed to serve the app app.UseStaticFiles(); // the Blazor app will be hosted as static files // ... // if an incoming request cannot be routed, re-route it to index.html: app.MapFallbackToFile("index.html");
Properties/launchSettings.json
"profiles": { "BethanysPieShopHRM.Api": { // ... // remove launchUrl line // add this line: "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", // ... }, "IIS Express": { // ... "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", } }
Add a project reference froom
BethanysPieShopHRM.Api
toBethanysPieShopHRM.App