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