What is the best / cheapest way to host a Blazor Server app and an open SQL database on Azure?

Connor Peters 6 Reputation points
2022-12-22T17:38:38.727+00:00

Hi together,
I have a Windows Forms app that uses data from an Azure SQL database. I don't need much database space, so until here, everything is fine and the pricing for the database is less than 5€ per month. Now, I want to host a Blazor Server app (.NET 6) that is supposed to use the same database. The app should be available on the public internet. If I use an Azure App Service for this (production) use case, the lowest cost variant is about 50€ / month (Tier B1: https://azure.microsoft.com/de-de/pricing/details/app-service/windows/). As I assume that 3 hours a day would be enough for the app, I'm also thinking about using Tier D1 (Shared Tier) which is about 10€ / month - but this is meant for development and testing, not for production. Is this an option that I should consider?
Having a look at the pricing tiers, the prices are "usage-based". Regarding the app service, what does this exactly mean? Is the mentioned price the highest price that is possible for one month?
Currently, I'm also thinking about using "Azure Web App + database", but the pricing doesn't seem really transparent for me. A disadvantage is, that the database is not open but can be configured for specific IP addresses. The windows forms app runs on multiple devices, so an open database would be the easiest way. I have also found out that you can host a .NET 6 Web app on a Linux service, which is cheaper than windows (https://azure.microsoft.com/de-de/pricing/details/app-service/linux/). Might this be an option?
The Blazor Server app does not require much performance as it only performs reading and writing operations for small amounts of data. This is why I currently think that D1 might be the best solution, even though it is not meant for production use. 50+€ / month is too much for this simple use case, so B1 might be a bit too much. Actually I don't want to host a complex web app, it is just a simple website with a C# backend to access the database.
Is there maybe a way that I haven't taken into consideration yet? I'm thankful for any advice.
Thank you very much and have a nice christmas time!
Connor

Azure SQL Database
Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,385 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,865 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 55,601 Reputation points
    2022-12-22T20:02:21.64+00:00

    a blazor server app uses signal/r and creates separate thread for each connection. so as long as the connection is open (blazor app open in browser) it is going to be using resources (websocket) . unless you enable signal/r service (an extra charge) you will be limited to about concurrent 300-350 blazor clients (max web sockets)

    as long as the tab hosting the blazor app is open the site must stay alive. webkit is pretty aggressive about shutting websockets in non-visible tabs,

    the cheapest and most scalable option: blazor WASM hosted by an azure static site, and azure functions for the supporting webapi. you can use a serverless sql database. the azure static site support proxy to azure functions so no CORS required.

    1 person found this answer helpful.
    0 comments No comments

  2. Rijwan Ansari 746 Reputation points MVP
    2023-01-12T01:35:37.4133333+00:00

    Hi,

    If you are not doing many things with Blazor App, then you go for Azure Static App. You can change Blazor server to WASM – Static app. Then Azure Function for backend operations.

    Pricing for Azure Static Apps

    User's image

    I guess, this will be cost-effective in your case.

    0 comments No comments

  3. Tom Simmons 1 Reputation point
    2023-10-29T18:40:34.59+00:00

    @Bruce (SqlWork.com) / @Rijwan Ansari

    I have been trying to find information, and ideally an example/guide, on how to do a Blazor WASM tab in Teams FX that uses Azure Functions - this would essentially be a Blazor Serverless setup from what I can tell - can you provide any guidance pointers please?

    Tom