I have a subtask with IHostedService
in my API and I have a question.
How can I do that whenever there is a new instance in Azure, this service will not be duplicated?
It is a process that sends daily emails. If this doubles then my clients may end up receiving two identical emails.
services.AddSingleton<IHostedService>(provider => new SendScheduledReportsService(provider.CreateScope()));