jimjim
jimjim

Reputation: 2503

what is equivalent of a windows service on azure?

what is the way to have an always running process on azure? on windows it is windows service, but do i have to get a virtual machine just to have a single running process? I have looked at various compute options but none of them seems to match what a windows service does. Is there a different way to achieve what a windows service does on azure?

Upvotes: 56

Views: 46030

Answers (3)

Dipendu Paul
Dipendu Paul

Reputation: 2753

Azure function is a good candidate for migrating windows services into something cloud based. Azure function can be triggered by a timer and so like a windows service can be scheduled at a certain time of the day for example.
Please give read to my notes that I wrote while I worked on such a migration: https://dumanhilltechnologies.com/blog/windows-service-migration-to-azure-function/

An Update The above link is no more available, so please refer to Microsoft's documentation on timer-triggered Azure function here https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-timer?tabs=in-process&pivots=programming-language-csharp

Other options in .net core are to write a BackgroundService and host it using Azure App Services or in a container instance using Azure Container Services.

Upvotes: 5

Neil Mackenzie
Neil Mackenzie

Reputation: 2847

You should look at continuously-running web jobs. See Running Background tasks with WebJobs on Microsoft Azure.

Other choices are PaaS cloud services worker roles and Azure Service Fabric reliable services - but these are likely overkill if you just want a basic service.

Upvotes: 21

David Makogon
David Makogon

Reputation: 71030

There is no specific way to run your code in Azure. You have lots of choices, and which you choose is really up to you (and a matter of opinion). But, objectively speaking:

  • Install your service as you always have, in a Windows Server VM
  • Run your code, without the Windows Service wrapper, in a VM (either Windows or Linux, depending on language)
  • Pull your core code out of the service, and run it within a web/worker role (cloud service).
  • Run your code in a WebJob.
  • Run your code in a Web App (you'd need to add some way to get to it, like a REST API sitting in front of it)

I see that @Neil suggested Service Fabric in his answer. That works too, except you'll need to learn about Service Fabric in general, since it works a bit differently.

Upvotes: 42

Related Questions