I have a project that has two pages and I need to create page one with blazor web assembly and create page two with blazor server side any idea on how to configure the project for this point?
This future will be available in Blazor .net 8 for more information, visit .net 8 preview 5 features Learn More at Microsoft docs
The two hosting models cannot be mixed in one project at the time (in NET 6.0), as far as I know. However, there may be certain workarounds that provide what you need for your use case. Granted, I have little insights into your use case and why you would need a page from different hosting models, so these may not work for you.
Alternative 1:
You can use the third hosting model option, Blazor WASM Hosted, which is a Blazor WASM client served from an ASP.NET Core server project. With this, you can do everything you need on both client- and server-sides. This hosting model provides a lot of flexibility and advantages (e.g. prerendering). While it mainly uses HTTP to communicate between the two, you can use SignalR as well.
Alternative 2:
Alternatively, you could make two separate projects (one WASM and one Server) that you point to the same domain (with either a subdirectory for each, or different subdomains). It's more work to host this, and you may need to different build pipelines - still, it may work for your needs if the two pages are separate and independent.
Edit: This is coming to .NET 8 and Blazor United.
© 2022 - 2024 — McMap. All rights reserved.