Blazor windows forms server

I was following along this tutorial: https://learn.microsoft.com/en-us/aspnet/core/blazor/hybrid/tutorials/windows-forms?view=aspnetcore-9.0 and it worked fine. Now I am wondering if it's possible to also expose it as a web server? I tried googling, I tried chatgpt which went on a hallucination spree. I am hoping it's not something absurdly obvious.
Build a Windows Forms Blazor app
Build a Windows Forms Blazor app step-by-step.
2 Replies
x0rld
x0rld2w ago
what are you trying to do ?
SlightlyTango
SlightlyTangoOP2w ago
var services = new ServiceCollection();
services.AddWindowsFormsBlazorWebView();
blazorWebView1.HostPage = "wwwroot\\index.html";
blazorWebView1.Services = services.BuildServiceProvider();
blazorWebView1.RootComponents.Add<Counter>("#app");
var services = new ServiceCollection();
services.AddWindowsFormsBlazorWebView();
blazorWebView1.HostPage = "wwwroot\\index.html";
blazorWebView1.Services = services.BuildServiceProvider();
blazorWebView1.RootComponents.Add<Counter>("#app");
I am trying to expose it not just inside of the desktop app, but also as a simple webserver. (which might not be possible, when I am reading the manual now, since it seems like it's fundamentally not how it works)

Did you find this page helpful?