Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Hosting .NET 8 Blazor Web App with ASP.NET API

$
0
0

Hey im Building a small Webside atm. For the Frontend i am using the new .NET 8 Blazor Web App with SSR and for the Backend an .NET 8 ASP.NET API. Is it still possible to host the Blazor Web App with the ASP.NET Backend, like in the old .NET 7 "ASP.NET HOSTET BLAZER WASM" and how?

I tryed the old aproach of .NET 7 but this doesnt work because there is no index.html anymore.This is my Programm.cd of the ASP.NET API.

var builder = WebApplication.CreateBuilder(args);builder.Services.AddControllersWithViews();builder.Services.AddRazorPages();builder.Services.AddEndpointsApiExplorer();builder.Services.AddSwaggerGen();builder.Services.AddSingleton<DockerService>();var app = builder.Build();// Configure the HTTP request pipeline.if (app.Environment.IsDevelopment()){    app.UseSwagger();    app.UseSwaggerUI();    app.UseWebAssemblyDebugging();}app.Urls.Add("http://localhost:5000");app.UseHttpsRedirection();app.UseBlazorFrameworkFiles();app.UseStaticFiles();app.UseAuthorization();app.MapRazorPages();app.MapControllers();app.MapFallbackToFile("index.html");app.Run();

I have added the Frontend as Reverence like in .NET 7.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>