How to periodically run a process from a Blazor Server Application

AlphonseG 236 Reputation points
2023-02-15T15:00:14.13+00:00

Coming from ASP.Net Webforms, I'm just getting started with Blazor and have gone through several tutorials, but still have a great deal to learn. I'm planning on a Blazor server application that will be deployed to a shared web host.

There will be a database task that I would like to run once or twice each day. With webforms, I would call it in the application start event.

I haven't been able to determine if Blazor has a similar event. Does it? If not, how can I periodically run my task?

Developer technologies | .NET | Blazor
0 comments No comments
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 78,006 Reputation points Volunteer Moderator
    2023-02-15T17:21:14.25+00:00

    as blazor server is asp.net core app, you use the background task support:

    https://learn.microsoft.com/en-us/aspnet/core/fundamentals/host/hosted-services?view=aspnetcore-7.0&tabs=visual-studio

    note: as blazor server requires a dedicated signal/r connection per client and long running server requests, check that it it supported by your hosting company.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.