In my blazor app, I'm trying to get @rendermode InteractiveAuto to work, so I created a simple sample project by creating a new project and including the sample pages.
I now have button on my home page with an onclick function that is not getting called:
<button @onclick="ChangeAppName">Change App Name</button>
If I use @rendermode InteractiveWebAssembly
or @rendermode InteractiveAuto
, then I get an error in the debug output that it can't find the home page, even though it is showing it. If I use @rendermode InteractiveServer
, then it works, (the AppName changes and the breakpoint is hit) even though I still get the Error in connection establishment: net::ERR_CONNECTION_RESET
in the browser console.
What is the trick to getting auto to work in the sample app?
And is ERR_CONNECTION_RESET normal and I can ignore it?
I tried this in .Net8 and 9 with the same result.
UPDATE
I'm confused by example 7 on this page: https://learn.microsoft.com/en-us/aspnet/core/blazor/components/render-modes?view=aspnetcore-9.0
@page "/render-mode-7"
<SharedMessage @rendermode="InteractiveServer" />
<SharedMessage @rendermode="InteractiveWebAssembly" />
Does this page go in the client or the server project?
To work in WebAssembly the page, in this case Home, must be in the Client project.