Reputation: 9380
Disclaimer
I am referring to Blazor
hosted , not server-side
!
Can someone please explain me when running browser
-hosted Blazor
, why do i need to place in the Server.Startup
the extension app.UseBlazor<Client.Startup>
?
If the Blazor
client is already hosted in a net core project
-> Client.Startup
why does my Server
project need to add this extension ?
Isn't the client
supposed to be decoupled from the server?
I am missing something here ? Why does my Server
project need to know about the Client
since my Client
project is already standalone ?
I have added a picture.
So as you can see in my picture , if the server is communicating via
http
with the client, why do i need to add the extension ?
Blazor is already running in a asp-net-core
which is the Client
project am i not right?
Upvotes: 3
Views: 808
Reputation: 45764
"Why does my Server project need to know about the Client since my Client project is already standalone ?
"
No, yours is not a standalone project. Your project contains two apps. Just read what you wrote yourself. Do try to remove your server project and run the Blazor app. You've got a front-end app (Blazor) running in the Browser. But you need an app to serve the Blazor app: ASP.NET Core app that runs on a server.
"Blazor is already running in a asp-net-core which is the Client project am i not right?
"
As far as I know, Blazor is running under mono webassembly.
I would suggest you to read the contents of the UseBlazor method to learn what it does, and why it is needed. And as far as I recall it's Client.Program rather than Client.Startup.
Upvotes: 1