{"id":278,"date":"2021-02-23T21:06:00","date_gmt":"2021-02-23T21:06:00","guid":{"rendered":"https:\/\/staging.infragistics.com\/blogs\/?p=278"},"modified":"2025-02-19T07:41:35","modified_gmt":"2025-02-19T07:41:35","slug":"blazor-server-vs-blazor-webassembly","status":"publish","type":"post","link":"https:\/\/www.infragistics.com\/blogs\/blazor-server-vs-blazor-webassembly","title":{"rendered":"Blazor Server vs. Blazor WebAssembly: Just the Facts"},"content":{"rendered":"\n<p>Here is a problem: How to run .NET in the browser using something different from JavaScript, without a connection to the server and no add-ons or plugins?<\/p>\n\n\n\n<p>The solution: Blazor WebAssembly<\/p>\n\n\n\n<p>Here is another problem: How to build client-facing apps that rank&nbsp;well in Google?<\/p>\n\n\n\n<p>The solution: Blazor Server<\/p>\n\n\n\n<p>To understand all about how Blazor Server vs. Blazor WebAssembly work, differ, when they are used, and how exactly they form one of the most interesting and relatively new frameworks out there \u2013 Blazor &#8211; we\u2019ve put together the following sections in the article:<\/p>\n\n\n\n<p class=\"text--align-center\"><a class=\"trackBlogCTA ui-btn ui-btn--default ui-btn--sm\" title=\"Button \/ Ignite UI for Blazor \/ Try It Now\" href=\"\/products\/ignite-ui-blazor\/download\">Try Ignite UI for Blazor<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"what-is-blazor-webassembly\">What is Blazor WebAssembly?<\/h2>\n\n\n\n<p>Blazor WebAssembly, also known as&nbsp;WASM, is a standard developed by the&nbsp;<a href=\"https:\/\/www.computerhope.com\/jargon\/w\/w3c.htm\" rel=\"noopener\">W3C<\/a> (World Wide Web Consortium)&nbsp;for creating software that runs in the web browser. Unlike&nbsp;JavaScript, Blazor WebAssembly is compiled&nbsp;software that runs at near-native speeds on your CPU.<\/p>\n\n\n\n<p>Blazor WebAssembly programs can be written in other languages, such as C, that can then be compiled to WebAssembly bytecode. WebAssembly is not meant to replace JavaScript, but to run alongside it for programs (or parts of programs) that need to run as fast as possible.<\/p>\n\n\n\n<p>Blazor, which is supported by Microsoft, is an open source and cross-platform web UI framework for building single-page apps using .NET and C# instead of JavaScript. Blazor offers two supported ways to host web applications: Blazor Server and Blazor WebAssembly.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"blazor-blazor-server-vs-blazor-webassembly\">Blazor Blazor Server vs Blazor WebAssembly<\/h2>\n\n\n\n<p>As mentioned earlier Blazor can run your client-side C# code directly in the browser, using WebAssembly. Because it is real .NET running on WebAssembly, you can re-use code and libraries from server-side parts of your application.<\/p>\n\n\n\n<p>Alternatively, Blazor can run your client logic on the server. Client UI events are sent back to the server using SignalR &#8211; a real-time messaging framework. Once execution completes, the required UI changes are sent to the client and merged into the DOM.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Blazor Server<\/h3>\n\n\n\n<p>Blazor Server uses a standard ASP.NET Core application. Within that application, you can integrate server-side functionality, such as integrating a SQL Server database through Entity Framework (an open-source, object-relational mapping framework that originally shipped as an integral part of the .NET Framework).<\/p>\n\n\n\n<p>The Blazor Server application communicates with the browser through a constant connection using SignalR. You can create client-side pages using Razor components or Razor pages.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/static.infragistics.com\/marketing\/Blogs\/Migration\/00\/00\/00\/03\/12\/blazor-server-signalr-example.png\" alt=\"Blazor Server Example with SignalR\" title=\"Blazor Server Example with SignalR\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Blazor Server apps are fast to load and simple to implement. Support for Blazor Server is available with .NET Core 3.1 LTS.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Blazor WebAssembly<\/h3>\n\n\n\n<p>Blazor WebAssembly allows the browser to download the Blazor application.<\/p>\n\n\n\n<p>This means that the Blazor application runs in the web browser. No need for a constant connection with a server for the application to work.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/static.infragistics.com\/marketing\/Blogs\/Migration\/00\/00\/00\/03\/12\/web-assembly-diagram.png\" alt=\"Blazor WebAssembly Example\" title=\"Blazor WebAssembly Example\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>However, because it&#8217;s solely a client-side application, you can&#8217;t directly integrate any server-side functionality into the Blazor application.<\/p>\n\n\n\n<p>In-order to do that, you would need to hook it up with a server-side application, such as an ASP.NET Core Web API.<\/p>\n\n\n\n<p>Like with Blazor Server, we can create client-side pages using Razor components or Razor pages.<\/p>\n\n\n\n<p>Similar to JavaScript, Blazor WebAssembly apps run securely on the user\u2019s device from within the browser\u2019s security sandbox. These apps can be deployed as completely standalone static sites without any .NET server component at all, or they can be paired with ASP.NET Core to enable full stack web development with .NET, where code can be effortlessly shared with the client and server.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"full-line-of-blazor-features\">Full Line of Blazor Features<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Blazor WebAssembly comes packed with features to keep you productive on your next web app project:<\/li>\n\n\n\n<li>Leverage the productivity of C# and strong runtime typing<\/li>\n\n\n\n<li>Build on the stable and mature .NET ecosystem<\/li>\n\n\n\n<li>Easily reuse code and existing .NET standard libraries on the client and server<\/li>\n\n\n\n<li>Shared&nbsp;component model&nbsp;with Blazor Server apps, implemented in&nbsp;<a href=\"https:\/\/docs.microsoft.com\/en-us\/aspnet\/core\/mvc\/views\/razor?view=aspnetcore-5.0\" rel=\"noopener\">Razor<\/a>&nbsp;component files<\/li>\n\n\n\n<li>Deploy your app&nbsp;as a standalone static site, or host it with ASP.NET Core<\/li>\n\n\n\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/aspnet\/core\/blazor\/progressive-web-app\" rel=\"noopener\">Build Progressive Web Apps (PWA)<\/a>&nbsp;with offline capabilities and native OS integration<\/li>\n\n\n\n<li>Built-in support for&nbsp;<a href=\"https:\/\/docs.microsoft.com\/aspnet\/core\/security\/blazor\/webassembly\/\" rel=\"noopener\">authentication<\/a><\/li>\n\n\n\n<li>Integrated&nbsp;globalization &amp; localization&nbsp;support<\/li>\n\n\n\n<li>Environment-based&nbsp;<a href=\"https:\/\/docs.microsoft.com\/aspnet\/core\/blazor\/hosting-model-configuration\" rel=\"noopener\">configuration<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/docs.microsoft.com\/aspnet\/core\/host-and-deploy\/blazor\/configure-linker\" rel=\"noopener\">IL trimming<\/a>&nbsp;and build-time&nbsp;<a href=\"https:\/\/docs.microsoft.com\/aspnet\/core\/host-and-deploy\/blazor\/webassembly#brotli-precompression\" rel=\"noopener\">precompression<\/a><\/li>\n\n\n\n<li>Full stack&nbsp;<a href=\"https:\/\/docs.microsoft.com\/aspnet\/core\/blazor\/debug\" rel=\"noopener\">debugging<\/a><\/li>\n\n\n\n<li>Great tooling with Visual Studio, Visual Studio for Mac, and Visual Studio Code<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"what-is-signalr\">What is SignalR?<\/h2>\n\n\n\n<p>SignalR is a library for ASP.NET developers to simplify the process of adding real-time web functionality to applications. Real-time web functionality is the ability to have server code push content to connected clients instantly as it becomes available, rather than having the server wait for a client to request new data. Chat application is often used as SignalR example.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"blazor-server-vs-blazor-webassembly-when-to-use\">Blazor Server vs Blazor WebAssembly \u2013 When to Use?<\/h2>\n\n\n\n<p>The hosting model you should use will depend on the objectives and the features you want to offer in your application. If you plan to use the application where Internet connectivity is weak, you might opt for Blazor WebAssembly as it functions well without a server connection. It\u2019s also a better choice if you prefer to work offline.<\/p>\n\n\n\n<p>On the other hand, if you\u2019re looking to build client-facing applications that rank&nbsp;well in Google, Blazor Server is a better choice.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"blazor-webassembly-vs-angular\">Blazor WebAssembly vs Angular<\/h2>\n\n\n\n<p>Angular, the successor of AngularJS, was created by Google to allow frontend developers to interact with both frontend and backend at the same time. Because Angular is JavaScript based, there are a lot of resources to work with.<\/p>\n\n\n\n<p>Angular has been around for a long time, unlike Blazor. It is a production-ready framework with full support for MVC\/MVVM applications and it is being used by many large companies. Blazor, on the other hand, is continuously being changed and has not yet achieved enough maturity to contend with Angular, despite being very promising. Angular tooling is also more mature with full debugging support in IDEs like VS Code.<\/p>\n\n\n\n<p>For a more in-depth look at the comparison, check out the <a href=\"\/blogs\/blazor-vs-angular\/\">Blazor vs Angular Comparison in 2022 blog.<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"us-presidential-election-dashboard-built-in-blazor-webassembly\">US Presidential Election Dashboard Built in Blazor WebAssembly<\/h2>\n\n\n\n<p>To help illustrate the kind of visualizations and analysis that can be supported in a Blazor application, our team at Infragistics created the <a href=\"\/resources\/sample-applications\/us-presidential-election-dashboard\">U.S. Presidential Election Dashboard,<\/a> a sample application that compares current and historical data and identifies data trends.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/static.infragistics.com\/marketing\/Blogs\/Migration\/00\/00\/00\/03\/12\/Blazor-WebAssembly-Example-Sample.gif\" alt=\"Blazor WebAssembly Example Application\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>This dashboard provides interactive visualizations of election data up to the 2020 election. Built-in Blazor (WASM) using Ignite UI for Blazor, this sample application features our Blazor Data Grid, Blazor Tree Map, Blazor Map, and Blazor Data Chart components.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"blazor-webassembly-components\">Blazor WebAssembly Components<\/h2>\n\n\n\n<p><a href=\"\/products\/ignite-ui-blazor\">Ignite UI for Blazor<\/a> from Infragistics includes professionally designed Blazor components including full support for Blazor Server, Blazor WebAssembly, and .NET 6. You can create rich web applications using your C# skills and eliminate complex and hard to learn JavaScript. Ignite UI for Blazor controls include the fastest data grid, 60+ high-performance&nbsp;<a href=\"\/products\/ignite-ui-blazor#chart\">charts<\/a> \u2014 stock charts, financial charts, geospatial maps, multi-column combo box \u2014 and more.&nbsp;<\/p>\n\n\n\n<p>We built our full-featured, lightweight <a href=\"\/products\/ignite-ui-blazor\/blazor\/components\/grids\/data-grid\">Blazor Data Grid <\/a>and Blazor Table to meet the challenge of displaying high volumes of data, while providing all the interactive features your customers expect. The Data Grid and all the Ignite UI Blazor components were designed for modern C# Blazor apps, including full support for Blazor WebAssembly, so you can deploy to any modern browser for the <a href=\"\/blogs\/build-great-user-experiences-with-user-centered-design\/\">best possible user experience<\/a>.<\/p>\n\n\n\n<p>And here is something else exciting for Blazor devs. We have released <a href=\"https:\/\/www.appbuilder.dev\/platform\" rel=\"noopener\">App Builder<\/a> for Blazor! What does this mean for your app development process?<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>App Builder is a complete cloud-based WYSIWYG drag &amp; drop tool that eliminates the complexity of UI design with a cloud-based IDE that lets you create apps and themes and add data binding in a snap!<\/li>\n\n\n\n<li>You\u2019ll be creating your Blazor apps 10x faster!<\/li>\n\n\n\n<li>With the App Builder acting as your <a href=\"https:\/\/www.appbuilder.dev\/blog\/what-is-low-code-development\" rel=\"noopener\">low-code development tool<\/a>, everything that you design will result in production-ready code for Blazor.<\/li>\n\n\n\n<li>With the Code Preview, you can see your clean, testable source\u202fcode\u202fbeing generated in real time while you build your app!<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"\/products\/ignite-ui-blazor\/download\"><img decoding=\"async\" src=\"https:\/\/static.infragistics.com\/marketing\/Blog-in-content-ads\/Ignite-UI-Blazor\/ignite-ui-blazor-you-get-ad.gif\" alt=\"Blazor Server vs Blazor WebAssembly\"\/><\/a><\/figure>\n\n\n\n<p>Find out more about our blazing fast Blazor Data Grid and see a Blazor Grid example <a href=\"\/products\/ignite-ui-blazor\/blazor\/components\/grids.html\">here<\/a>.<\/p>\n\n\n\n<p>If you are considering Blazor and have any questions, shoot me an email <a title=\"jasonb@infragistics.com\" href=\"mailto:jasonb@infragistics.com\" target=\"_blank\" rel=\"noopener noreferrer\">jasonb@infragistics.com<\/a>!<\/p>\n\n\n\n<p>And if curious, you can read our comparison articles on <a href=\"\/blogs\/blazor-vs-angular\/\">Blazor vs Angular<\/a> and <a href=\"\/blogs\/blazor-vs-react\/\">Blazor vs React<\/a>.<\/p>\n\n\n\n<p>Happy Coding!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Find out what is Blazor Webassembly, and how does it compare to the Blazor server. This article takes a closer look at Blazor WebAssembly and why it\u2019s got a lot of buzz.<\/p>\n","protected":false},"author":81,"featured_media":1321,"comment_status":"publish","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-278","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blazor"],"_links":{"self":[{"href":"https:\/\/www.infragistics.com\/blogs\/wp-json\/wp\/v2\/posts\/278","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.infragistics.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.infragistics.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.infragistics.com\/blogs\/wp-json\/wp\/v2\/users\/81"}],"replies":[{"embeddable":true,"href":"https:\/\/www.infragistics.com\/blogs\/wp-json\/wp\/v2\/comments?post=278"}],"version-history":[{"count":6,"href":"https:\/\/www.infragistics.com\/blogs\/wp-json\/wp\/v2\/posts\/278\/revisions"}],"predecessor-version":[{"id":1923,"href":"https:\/\/www.infragistics.com\/blogs\/wp-json\/wp\/v2\/posts\/278\/revisions\/1923"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.infragistics.com\/blogs\/wp-json\/wp\/v2\/media\/1321"}],"wp:attachment":[{"href":"https:\/\/www.infragistics.com\/blogs\/wp-json\/wp\/v2\/media?parent=278"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.infragistics.com\/blogs\/wp-json\/wp\/v2\/categories?post=278"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.infragistics.com\/blogs\/wp-json\/wp\/v2\/tags?post=278"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}