5

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?

6
  • 1
    you cant run a mix of server & wasm together, it's due to happen for .net 7 Commented Jul 25, 2022 at 17:46
  • can I see any reference to show me that happens in .net 7? Commented Jul 26, 2022 at 5:16
  • because one of the Microsoft engineers told me it is possible Commented Jul 26, 2022 at 5:18
  • 2
    youtu.be/3o91I6lD-Bo?t=3179 see that slide top right first item where it shows "Mix Blazor Server and WebAssembly" , however this is wish list of what we may or not get, I'm watching this space keenly, if you do find anything please postback..! Commented Jul 26, 2022 at 15:23
  • 1
    I found this itnext.io/… Commented Jul 26, 2022 at 16:09

2 Answers 2

5

This future will be available in Blazor .net 8 for more information, visit .net 8 preview 5 features Learn More at Microsoft docs

Sign up to request clarification or add additional context in comments.

Comments

3

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.