S
S
soundie2022-02-22 16:43:06
ASP.NET
soundie, 2022-02-22 16:43:06

What type of .NET application to choose if you need fault tolerance - regular console, ASP.NET or Worker Service?

You need to create an application for the .NET 5 platform on a virtual server (VPS) under Linux. The application is simple: receive data from sensors via HTTP about once a second, process them and send them back with a regular HTTP GET request. There are several sensors, so for sure it will be asynchronous (parallel). It is highly desirable to ensure the fault tolerance of this whole thing, that is, even if there is suddenly some kind of bug, then so that you can easily code an automatic restart.

What type of project would be optimal for such a task - a regular console, ASP.NET application (WebApp or WebAPI?) Or did you also notice a suitable Worker Service from the description?

I just need to find out in which direction to dig, that is, to understand which of the project templates is best suited for this task.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Golubkov, 2022-02-22
@soundie

2 options may suit you: WebAPI or Worker Service.
WebAPI will provide you with an endpoint (node) to which you can make HTTP requests from the browser, via curl, etc. I.e. the initiator of some action will be a request from outside. But since your process should work on its own, without human intervention, this option is not particularly suitable, but you can add a scheduler, for example, Quartz, which will run the code you need once at the specified time. And via HTTP, you can periodically collect statistics on the operation of your application.
Worker Service - works by itself, you can do the work on a schedule or according to other conditions. Write a function - it will be called by itself. I think you need this option.
About fault tolerance: you can google the Health Check mechanism, you can set up an automatic check of the life of your service and, if a bad state is detected, automatically restart it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question