I've download Visual Studio 2022 and tested the default Blazor Server template (Home/Counter/FetchData). In Visual Studio, IIS Express I can open as many tabs / instances of the application as I want.
When I host the default Blazor Server template in local IIS (Windows 10 Home 21H2, IIS 10) I can only open three instance of the application. The fourth will hang until the first is closed. I see someone has ran into
Workaround: install IIS Express
in Web Platform Installer.
Workaround: Try to deploy it in windows server, and check whether have same issue. I found some posts also mentioned it may related with OS version.
CodePudding user response:
The solution was incredibly simple (maybe too simple?). Don't use IIS at all.
- In
Program.cs
just before building the app I override Kestrel ports to listen on any ip (for now). - (Optional) I provide a custom SSL certificate in the
UseHttps
constructor so that it can be emailed and installed on iOS and Android devices. - (Required) Then I publish the applications to a folder and just run the
.exe
on the hosting machines.
Program.cs
builder.WebHost.ConfigureKestrel(opt =>
{
opt.ListenAnyIP(8000);
opt.ListenAnyIP(8001, listOpt =>
{
listOpt.UseHttps(@"Path to.pfx file", "password for pfx file");
});
});
Now Windows 10 Home can support as many connections as the hardware can handle at https://192.168.0.XXX:8001
. Is this how Blazor Server is expected to be deployed within a local network? I don't understand how this overcomes the connection limit pointed out in masons answer. Please let me know in the comments if I'm missing something.