Free Hosting

Free hosting of static websites in Microsoft Azure! So hosting a Blazor client side application as a static website on Azure is free. Free is alway interesting so I thought I’d give it a try. Here’s what happened.

I created a Webassembly or Client Side version of the Blazor Component Authority Demonstration application and discovered ProtectedLocalStorage works in a Blazor Server Side application but does not work in a Blazor Client Side application. The InputHistoryBCA component uses ProtectedLocalStorage so I had to make a change to it. The fix was to use the JSRuntime and call the Javascript localStorage methods in the Client Side version of the component. Of course Javascript localStorage does not encrypt the stored value so that protection is not available in the client side version.

The Webassembly version of the demonstration app also does not provide direct navigation to a particular page since it’s a single page application (SPA) and hosted as a static webpage. Requests to the server for anything other than the root or index address will return a 404 error since the server only has one page (index.html) to serve. To see the code for the Webassembly version of InputHistoryBCA go to the Webassembly version of the demonstration app and select the InputHistoryBCA option in the menu then click Component Markup and Code – Show Code link.

So the conversion and deployment of the Blazor Server Side version to a Client Side version wasn’t difficult and so far does appear to be free to host on Azure since the app does not utilize a web API or database. If it did then there would be some cost to hosting the web API and database but from what I can gather the cost for a low demand application would be somewhere under $20 per month as of this writing. The costs are based on compute time and memory usage so of course the cost will go up with an increase in resource demand.

Thanks for reading.

Site Footer

Sliding Sidebar