azureazure-functionsasp.net-core-hosted-services

Azure function vs ASP.NET Core Worker Service?


How does a Azure function differ from a ASP.NET Core Worker Service?

Does both of these cover the same use cases? How do I decide which one to use?


Solution

  • Update:

    Azure function is designed for azure. So when you use azure, or other azure services which are integrated with azure function, you should consider azure function, which could simplify your code and logic by the built-in features of azure function. But it will also have charges for azure function. And yes, if you don't use azure, just use asp.net core worker services.


    Azure function are totally different from ASP.NET Core Worker Service.

    The benefit of Azure function is that it supports a lot of triggers like azure blob trigger / azure event hub trigger, and is integrated with other azure services.

    With these built-in features, it's easy to create a proper azure function to complete a proper task. For example, if you upload an image to azure blob storage, and then want to resize the image, you can easily create a blob trigger azure function with less code.

    Worker services are the perfect use case for any background processing. And if you want to operation some azure services like azure blob / azure event hub etc. you may achieve this but need to do a lot of work.

    At last, it depends on your use case to choose which one should be used, and select the simple / efficient one.