What is Blazor?

Blazor is a framework from Microsoft that you can use to develop interactive client-side Web UIs using C# instead of traditional JavaScript. There are two primary hosting models which we will cover more in detail down below.

How We Used to Develop Web Applications

I remember almost a decade ago when I was sitting in high school and I was messing with pure HTML and JavaScript. What boggled my mind at the time was learning about JavaScript and how powerful it was.

A while back, we only built applications that ran on the server. These applications generated HTML files to be pushed out to the browser using technologies like ASP.NET, PHP, etc.

There has been interactivity with JavaScript and AJAX but for many years but the business logic was usually handled on the server itself. The browser for the longest time was just a plain document viewer.

It’s funny how we view PDFs using our default browser today. This was sort of the feeling for how web applications were back in the day.

Disadvantages of Server Side applications

Server side applications were great for it’s time. But of course as new technology emerged, the old started to become obsolete or no longer maintained. Whenever technology isn’t maintained, bugs and security issues rise up extremely fast.

Let’s talk about some disadvantages of server side applications. One disadvantage is that the server needs to be configured with the proper software to run the web app.

Runtimes have to exist on the server. Most of the processing power is on the server, which can essentially make page load times very slow. Connection speeds and latency can play a big role on how applications are processed and transported.

Since it’s server-side processing, page post back can introduce processing overhead that can decrease performance and make the user wait for the page to be processed. Now a days this will most definitely be a negative experience. We are in the era of user experience, we can’t be having this issue.

How Are We Developing Now?

Today with the rise of single page applications we can utilize frameworks like Angular, React, Vue, etc. These frameworks essentially mean that we are building full applications in JavaScript that run on the browser.

JavaScript applications run client-side that use messaging to communicate with the server. The server doesn’t have to be a physical server, it can easily be a service or an application in the cloud.

I have worked with various cloud applications in my time. We are truly moving towards a future where enterprise companies won’t have the need to have physical servers. Cloud and infrastructure engineers are making developer’s lives much easier.

This is a significant improvement on what we used to do before when applications were completely server side. Now we can have applications running in the browser, without pure reliance on the server.

Blazor improves on how we are developing now a bit further. It offers two main ways to develop with it. The app and component models are the same in both these hosting models.


WebAssembly Model

Let’s take a look at one of the ways to develop Blazor: WebAssembly. Blazor uses WebAssembly which is in all major browsers at this point. But what exactly is WebAssembly?

WebAssembly is a binary instruction format for a stack-based virtual machine. Wasm is designed as a portable target for compilation of high-level languages like C/C++/Rust, enabling deployment on the web for client and server applications.


But what does it all mean? Think of the browser as a host for your application. The files that are built in a Blazor WebAssembly application are compiled and sent to the browser. The browser then runs your JavaScript, HTML and C# in an execution sandbox on the browser. Alongside all that it runs a version of the .NET Runtime.

You can execute calls to .NET from within the browser, and it’s a fully-fledged application in the browser. It is wild to imagine that you can run C# in the browser without specific server side software that is limited to a certain range of operation systems.

WebAssembly: The Good ? 

  • You can use C# to develop rich front-end applications.
  • Various .NET components can be reused in your application.
  • Best of all in my opinion, you can use Microsoft tooling and debugging. I absolutely love the debugging you can do in C#.

WebAssembly: The Bad ?

  • We can’t just write code and run it out of the box. You will need to download and install the .NET Framework and other run time files at least once.
  • You are restricted to the limitations of the browser
  • Not all .NET Framework components are compatible

Luckily we aren’t just limited to this option. There is another option we can utilize to develop Blazor applications!

Blazor Server

Blazor Server Model

Let’s take a look at another option we can develop Blazor applications with: Blazor Server. This application process is similar to what we have today with the frameworks we talked about above. We build an application and have a server that’s powered by .NET Core, and you can send HTML and JavaScript to communicate with the browser to act as a client.

Blazor Server Benefits

  • App can take full advantage of server capabilities.
  • .NET Core on the server is used to run the app, so debugging works as expected.
  • Blazor Server apps work with browsers that don’t support WebAssembly.
  • The app’s .NET/C# code base isn’t directly server to the clients.

Downsides to Blazor Server

  • It can be very slow depending on connection.
  • It cannot be support offline, meaning if the connection breaks the app just stops working.
  • An ASP.NET Core server is required to serve the app, you can’t serve the app from a CDN (Content delivery network)

Which one to use?

Well if you want powerful client-side applications which will run offline then you should go with Blazor Web Assembly. If you want the full power of .NET and want to run it on all kinds of browsers that aren’t limited, then you should go with Blazor Server.

My Personal Thoughts on Blazor

In my personal opinion, I predict WebAssembly will be the future out of these two hosting options. Sure it has it’s advantages and disadvantages, but it truly pumps out powerful client-side applications.

Speed is a very important factor in a decision to utilize any technology. I want to wait for more Blazor development in order to assess whether or not Blazor stands a chance against popular frameworks and technologies today.

I absolutely ❤️ the C# language, and just thinking about C# in the browser makes me so excited. When .NET Core was first announced, I knew one day it would make huge strides.

Cross platform technologies go well with developers who wish to save time and not have to work out two separate code bases. This is why I think Blazor Server isn’t quite there yet as it has to be hosted on an ASP.NET CORE Server. If it ever gets to the point where you can serve it from a CDN, it will become very powerful.

Thank you for taking the time to read this article! If you want to get started with Blazor, see the links below. These will kick you off on the right track.

Blazor Resources

1 Comment

  • Jack
    Posted February 5, 2020 1:27 pm

    Great article! I love Blazor so far, I am slowly incorporating it more in my development for my projects.

Comments are closed.

Get Started

Let’s work together. I’ll work hard to achieve your goals.

Singhaman © 2021. All rights reserved.

%d bloggers like this: