Fred
Fred

Reputation: 1221

Server side Blazor blazor.server.js instead of blazor.webassembly.js

I am trying out Server-side Blazor (.net core 3.0 Preview 5). I have been searching the web but can't seem to find an answer. I really like the "layout" of the Blazor (ASP.NET Core hosted) template (see image below). The client part of that is WebAssebly. But I read someware that I could change blazor.webassembly.js to blazor.server.js and that it would be it. How ever that doesn't work. I get some errors in the console log:

Error: Failed to complete negotiation with the server: Error: Internal Server Error blazor.server.js:1

Error: Cannot send data if the connection is not in the 'Connected' State. blazor.server.js:1

What do I need to do for the client to use blazor.server.js instead of blazor.webassembly.js?

Or have I just misunderstood everything?

Blazor templates

Upvotes: 0

Views: 1932

Answers (1)

enet
enet

Reputation: 45754

You are not consistent in describing what flavor of Blazor you're using. I'm going to provide you the code below of how to implement Blazor dual mode, but not without warning that though shifting from Blazor client side to Blazor server side, in configuration term is made simple by a developer named Suchiman, coding for the client can be very different than coding for the server, and you should know what you're doing and take into account many factors...

Here's the link that instruct you how to move to and forth: https://github.com/Suchiman/BlazorDualMode

Please don't hesitate to ask any question about the above. Next time select the blazor tag. I've got to this section by mere chance. The Blazor section is very active...

Upvotes: 2

Related Questions