In a Blazor Server app, the default RenderMode is Server Prerendered. When the component is rendering with the ServerPrerendered render mode, the component is initially rendering statically as part of the page.
On executing the first time, it is rendered as an MVC component directly when the page is requested and handled by “_Host” which is specified in “_Host.cshtml”.
<body>
<component type="typeof(App)" render-mode="ServerPrerendered" />
…….
</body>
Then the resources are loaded with the blazor.server.js script and start rendering a second time. Then the Razor pages are loaded as a Blazor component.
Note: If you are changing the RenderMode to Server, the lifecycle method executes only once.
[Pages/_Host.cshtml]
<body>
<component type="typeof(App)" render-mode="Server" />
…….
</body>
Refer to this link for details.
Share with