Which project type for Blazor and Why 100 days of Blazor

NOVATROOP77 266 Reputation points
2021-07-14T08:18:22.73+00:00

I am doing 100 days of code and already hit a learning curve in MVC we would have had a project that just lived on the server now in the blazor land we have.

WebAssembly
Server Side
Hosted asp.net core Blazor

Can someone explain to me the differences in each and why one should be used over the other, to me the most part the projects look identical expect one doesn't have appsettings.jason

If I was hosting this how do I deal with the two client/server apps on the one server tad confused here.

Developer technologies .NET Blazor
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2021-07-15T17:31:56.093+00:00

    it is pretty simple.

    originally blazor was WASM (WebAssembly) only, and a blazor project produced a static site to host the WASM and index.html page to load it (along with any supporting javascript. If you don't know web assembly, its a sandboxed virtual machine hosted by the browser. It allows running compiled code rather than javascript. The sandbox code can call javascript to perform actions not allowed in the sandbox, such as access to the dom, ajax calls, timers and file io. Once the WASM application is loaded, no server support is required. Typically you would use browser Service Workers to support off-line mode.

    if you wanted the blazor to make ajax calls, you would create a separate webapi project with CORS support that the blazor project could make ajax calls to.

    eventually a new combined project was created that allowed the blazor project to be in a core webapi project (similar to other SPA projects). CORS is then longer required, and you only have one project. The asp.net project also hosts the required static files for blazor.

    also a server only version of blazor was added. the blazor code is hosted on the server rather than as WASM, and the client interop code uses signal/r rather than WASM messages to communicate to the blazor server code. as the blazor code code (and all of its state) is maintained on the server, it can be a heavy server load. The server needs to create a dedicated thread and memory for each blazor connection.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.