using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.WebAssembly.Hosting; using SimpleWebChat.BlazorWasm; var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add("#app"); builder.RootComponents.Add("head::after"); builder.Services.AddScoped(sp => { var http = new HttpClient(); #if DEBUG http.BaseAddress = new Uri("http://swc-server"); #else var NavManager = sp.GetService(); var ba = new Uri($"{NavManager.ToAbsoluteUri("/").GetLeftPart(UriPartial.Scheme | UriPartial.Authority)}"); http.BaseAddress = ba; #endif return http; }); await builder.Build().RunAsync();