Separate worker and Windows Service roles along with another role

Windows Service Applications are useful for creating long-term applications that have their own sessions. They are useful for working in the background, without interfering with the main (or business applications) applications. The way to run these applications on Azure can be performed along with the actual roles by setting initial definitions of tasks (see 1 , 2 ).

On the other hand, the role of the worker constantly works in the background in the same way as long-running tasks. In addition to defining RoleEntryPointthe start, stop and start processes can be handled more easily, I think the methods ( OnStart(), OnStop()and Run()). In fact, this role provides the ability to update configurations in real time. In addition, performance indicators are provided. Similarly, you can run worker roles in elevated mode.

In this regard, if we compare the execution of a background task on a Windows service next to another role versus a separate Worker role, the latter approach seems to be beneficial. And yet there would be some reason to go with the first? If so, what is the advantage?

Let's say the task here is monitoring. The background task collected ETW events output by the application running on other roles and stored them in storage with preservation.

+4
source share
1 answer

These two are not mutually exclusive. You can still install Windows services, even as a worker (especially if the program identifier is designed specifically to run and manage in this way). To do this in a working (or network) role, you just need to link (or download) the appropriate installer to configure the service.

/- Windows. . . , cmd script / OnStart(). ( ), Run(). , , .

: -/ : , , / .:)

: Windows ( Web/worker), , .

+4