Skip to content

Commit

Permalink
Try without BlazorFrameworkFiles since they are included statically f…
Browse files Browse the repository at this point in the history
…rom client project.
  • Loading branch information
Layoric committed Oct 2, 2023
1 parent f992336 commit 0b80b42
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 24 deletions.
24 changes: 1 addition & 23 deletions Gallery.Unified.Client/Program.cs
Original file line number Diff line number Diff line change
@@ -1,31 +1,9 @@
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Blazor.Extensions.Logging;
using MyApp.Data;

var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.Services.AddLogging(c => c
.AddBrowserConsole()
.SetMinimumLevel(LogLevel.Trace)
);

// Use / for local or CDN resources
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
// builder.Services.AddScoped<AuthenticationStateProvider>(s => s.GetRequiredService<ServiceStackStateProvider>());

var apiBaseUrl = builder.Configuration["ApiBaseUrl"] ?? builder.HostEnvironment.BaseAddress;
builder.Services.AddBlazorApiClient(apiBaseUrl);

// builder.Services.AddScoped<ServiceStackStateProvider>();

var app = builder.Build();

BlazorConfig.Set(new BlazorConfig
{
IsWasm = true,
Services = app.Services,
FallbackAssetsBasePath = apiBaseUrl,
EnableLogging = true,
EnableVerboseLogging = builder.HostEnvironment.IsDevelopment(),
});

await app.RunAsync();
await builder.Build().RunAsync();
11 changes: 10 additions & 1 deletion Gallery.Unified/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
app.UseHsts();
}

app.UseBlazorFrameworkFiles();
//app.UseBlazorFrameworkFiles();

app.UseHttpsRedirection();

Expand All @@ -58,6 +58,15 @@
app.MapControllers();
app.MapFallbackToFile("index.html");

BlazorConfig.Set(new BlazorConfig
{
IsWasm = true,
Services = app.Services,
FallbackAssetsBasePath = baseUrl,
EnableLogging = true,
EnableVerboseLogging = app.Environment.IsDevelopment(),
});

app.MapRazorComponents<App>()
.AddServerRenderMode()
.AddWebAssemblyRenderMode();
Expand Down

0 comments on commit 0b80b42

Please sign in to comment.