Configuration of v4.20 - Azure App Service

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
3 years ago
Hi,

I'm installing v4.20 in Azure App Service, when I configure scheduled task to send emails sometimes it fails.

Reading the documentation, I find "Make sure the nopCommerce scheduling tasks run on one node of the farm at time", but I can't find this option in the web.config file.

How do I configure this option?
3 years ago
dev.omrc wrote:
Hi,
I'm installing v4.20 in Azure App Service, when I configure scheduled task to send emails sometimes it fails.
Reading the documentation, I find "Make sure the nopCommerce scheduling tasks run on one node of the farm at time", but I can't find this option in the web.config file.
How do I configure this option?


Have you checked the error logs and found out why the emails are failing?

Did you configure your Web app installation to have 2 or more instances? If not, you shouldn't need to worry about load balancing or configuring the scheduler.
3 years ago
I configure the App Service for scale out between 2-5 instances.

In the logs I have the following error:
Autofac.Core.DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = ProxySettings (DelegateActivator), Services = [Nop.Core.Domain.Security.ProxySettings], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> A second operation started on this context before a previous operation completed. This is usually caused by different threads using the same instance of DbContext, however instance members are not guaranteed to be thread safe. This could also be caused by a nested query being evaluated on the client, if this is the case rewrite the query avoiding nested invocations. (See inner exception for details.) ---> System.InvalidOperationException: A second operation started on this context before a previous operation completed. This is usually caused by different threads using the same instance of DbContext, however instance members are not guaranteed to be thread safe. This could also be caused by a nested query being evaluated on the client, if this is the case rewrite the query avoiding nested invocations.
3 years ago
dev.omrc wrote:
I configure the App Service for scale out between 2-5 instances.
In the logs I have the following error:---> System.InvalidOperationException: A second operation started on this context before a previous operation completed. This is usually caused by different threads using the same instance of DbContext
[/code]


Dbcontext is not thread safe. It doesn't seem like a web farm problem because the error raised is due to a single app instance accessing dbcontext concurrently. I did not look into the code so I could be wrong.

Do you need up to 5 instances? How many hits do you anticipate on your website?

Anyway, try making sure all your app instances have the same time zone. Check your configure task scheduling intervals. Increase the intervals if you don't need the tasks to run so frequently.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.