Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 312
Fred Avatar asked Dec 12 '19 12:12

Fred


People also ask

Do Azure Functions support .NET core?

NET Core 3.1 and . NET 5 Azure Functions are. As of March 2021, Microsoft announced that Azure Functions are supported running on . NET 5.

Can Azure Functions replace Web API?

Conclusion. Migrating from a simple web API that has little commercial pressure to Azure Function can save significant development and operational costs. By using the serverless platform, we can focus on the business logic itself rather than the infrastructure code.

What is .NET core worker service?

Worker Services were introduced in . NET Core 3.0, and allows for running background services through the use of a hosted service. Another way of running background services is to run hosted services within an ASP.NET Core web application.


1 Answers

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.

like image 103
Ivan Yang Avatar answered Oct 10 '22 23:10

Ivan Yang