Aenye Cerbin

Aenye Cerbin

  • 1.7k
  • 8
  • 832

Adding Blazor page to existing ASP.NET WebAPI.

Dec 1 2023 11:57 PM

Hi, I've an ASP .NET Core 8 Web API that provides a bunch of controllers and also has a background service for performing periodic tasks (like fetch some info and send mail based on the data fetched).

My solution contains main ASP .NET Core WebAPI project for controllers and Class Library project for services.

It works pretty good, but now I need to add some kind of admin page that will allow admin to view site state (logs, if background service is running) and manage the site (adding/editing mail templates).

I came with this cshtml pages first but it looks like it doesn't match my needs. I want to have the whole thing in C#. Than I started thinking of Blazor and was pretty overwhelmed by the informations I find. In my case should I use server side or client side Blazor? I need to add this to my existing API project, but I need the user to be able to perform tasks like button clicking, drop-down menu changes and so on.

Is my approach correct? How can I add Blazor to my existing WebAPI without creating additional apps? Should I use client side WevAssembly or setver-side Blazor app?

The templates in VS doesn't seem really clear and helpful. Thee is Blazor Standalone App, Blazor Server and Blazor Client WevAssembly.


Answers (2)