Reputation: 9700
We are working on a MVC Core project which requires to be hostable either on Azure, either on IIS (on premise), depending of the final customer wills. Our minimal support level is Windows Server 2012.
Along this project, we need to have a background process that will schedule some specific treatments.
In on premise context, a regular windows service would perfectly fit. But it can't be deployed easily in Azure, apart in a VM as described https://stackoverflow.com/a/36026658/461444
So we would like instead to know if there is a simple solution that can be exploited both as a Windows Service (or something very close), and as an Azure component in a single implementation.
Upvotes: 0
Views: 183
Reputation: 18556
How about using the background service feature of ASP.NET Core?
If you configure your website to keep running (Azure App Service: "Always On") your workload should work just fine. Just be aware of how many instances the AppService runs on and if you need to coordinate the instances. When in doubt, you can always just create two ASP.NET Applications, where one is just responsible for handling the background work. This way you can control the scaling and lifetime of each service independently.
Asp.NET Core 2.1 HostedService - keep running on Azure
Upvotes: 1
Reputation: 13965
I would create three projects:
The Windows Service can easily be deployed on an on-prem IIS server.
The Azure Function can easily be deployed into Azure without the need for an Azure VM.
(Side note: the thread you pointed to is three years old. I don't know if Azure Functions existed at the time.)
Upvotes: 1