{"id":2145,"date":"2020-05-17T22:17:57","date_gmt":"2020-05-17T22:17:57","guid":{"rendered":"https:\/\/wordpress-634681-2064240.cloudwaysapps.com\/?p=2145"},"modified":"2020-05-17T22:45:07","modified_gmt":"2020-05-17T22:45:07","slug":"hosting-blazor-webassembly-hosted-apps-in-azure-app-service-web-apps","status":"publish","type":"post","link":"https:\/\/www.petecodes.co.uk\/hosting-blazor-webassembly-hosted-apps-in-azure-app-service-web-apps\/","title":{"rendered":"Hosting Blazor WebAssembly Hosted Apps in Azure App Service Web Apps"},"content":{"rendered":"\n
Blazor is the buzzword in SPA frameworks in 2020. Microsoft are all in behind it, and for good reason.<\/p>\n\n\n\n
Born out of Knockout and developed off the cuff by Steve Sanderson, Microsoft grabbed his concept and ran with it.<\/p>\n\n\n\n
Now one of the better SPA frameworks out there, Blazor is free and open source.<\/p>\n\n\n\n
There are a few different version of Blazor to choose from, and I won’t go into much detail here about each one as there are a myriad of posts around that will discuss that in depth. <\/p>\n\n\n\n
The main two are;<\/p>\n\n\n\n
Microsoft are working on a few more experimental types too; <\/p>\n\n\n\n
Blazor PWA (Progressive Web App)
Blazor Hybrid – Native apps for Mobile Devices using web Technologies
Blazor Native – Fully native Mobile Apps using Native Controls
Blazor Desktop – Electron based Desktop Apps.<\/p>\n\n\n\n
You can find more info here… https:\/\/visualstudiomagazine.com\/articles\/2019\/09\/26\/blazor-future.aspx<\/a> <\/p>\n\n\n\n On top of the various different version of Blazor above, there are a couple of types of Blazor Web Assembly too;<\/p>\n\n\n\n Azure App Service<\/a> is a Microsoft offering within Azure which hosts Web Apps written in various languages including Dot NET Core, Node and PHP.<\/p>\n\n\n\n Azure App Service hosts the websites in containers, which means you can pick and choose which platform and operating system you’d like to run your app in.<\/p>\n\n\n\n Each individual application is stored in it’s own Web App hosted in a container in an App Service.<\/p>\n\n\n\n We always want to be working in an agile way, and employing a CI\/CD pipeline in our development is definitely what we should be doing along that journey.<\/p>\n\n\n\n One great way we can accomplish this is to combine Azure Web Apps and GitHub Actions.<\/p>\n\n\n\n We can use GitHub as our Source Control Repository and hook up a GitHub action which, whenever code is checked in to the repository, build our website files and publish them to an Azure Web App.<\/p>\n\n\n\n The is all orchestrated in code using a YAML file… This YAML file contains all the required steps as code to build the website, create the artefacts and publish them to the Web App.<\/p>\n\n\n\n There are a few steps we need to run through to get to the finished solution;<\/p>\n\n\n\n We’ll start out by creating a GitHub repository to house our code.<\/p>\n\n\n\n Head over to GitHub and Sign in. Next up create a new Repository. Make sure to add a README and also a Visual Studio .gitignore, as we’re going to be creating a Dot Net Core based project in Visual Studio. Personally I think this option is a little confusing, and really should be a more specific naming convention.<\/p>\n\n\n\nBlazor WebAssembly Flavours<\/h2>\n\n\n\n
Traditional Blazor WebAssembly<\/h2>\n\n\n\n
ASP Hosted Blazor WebAssembly<\/h2>\n\n\n\n
Azure App Service + Web Apps<\/h2>\n\n\n\n
Azure Web App and GitHub Actions<\/h2>\n\n\n\n
Getting Started<\/h2>\n\n\n\n
1: Create a GitHub Repo<\/h2>\n\n\n\n