Scheduled Tasks Error

3 months ago
Hi,

Since upgrading to Nop 4.2, I'm having issues with scheduled tasks like email sending, currency update, etc. It is giving me a parameter expiration error, as pasted below in full.

Please someone assist.

Error
Short message  
The "Update currency exchange rates" scheduled task failed with the "Specified argument was out of the range of valid values.
Parameter name: expiration" error (Task type: "Nop.Services.Directory.UpdateExchangeRateTask, Nop.Services". Store name: "Muriash eCommerce Limited". Task run address: "https://www.muriash.com/scheduletask/runtask").
Full message  
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: expiration
   at EasyCaching.Core.ArgumentCheck.NotNegativeOrZero(TimeSpan argument, String argumentName)
   at EasyCaching.InMemory.DefaultInMemoryCachingProvider.BaseSet[T](String cacheKey, T cacheValue, TimeSpan expiration)
   at EasyCaching.Core.EasyCachingAbstractProvider.Set[T](String cacheKey, T cacheValue, TimeSpan expiration)
   at Nop.Core.Caching.MemoryCacheManager.PerformActionWithLock(String key, TimeSpan expirationTime, Action action) in C:\andrei\nopcommerce\sources\src\Libraries\Nop.Core\Caching\MemoryCacheManager.cs:line 105
   at Nop.Services.Tasks.Task.Execute(Boolean throwException, Boolean ensureRunOncePerPeriod) in C:\andrei\nopcommerce\sources\src\Libraries\Nop.Services\Tasks\Task.cs:line 143
IP address  
64.20.49.130
Customer  
Page URL  
https://www.muriash.com/scheduletask/runtask
Referrer URL  
Created on  
8/12/2019 10:33:48 PM
3 months ago
Seems error is thrown from .net framework. You may find your solution from here.

https://stackoverflow.com/questions/17772216/specified-argument-was-out-of-the-range-of-valid-values-parameter-name-site
3 months ago
set Schedule tasks Seconds (run period)  value more than 10second. its work for me.
3 months ago
Hi,

Have done that, and restarted the application, but still no change.

sangeetshah wrote:
set Schedule tasks Seconds (run period)  value more than 10second. its work for me.
3 months ago
I had lots of problems with this, a few things to check.

Log onto your server and see if you can ping the domain and make sure it returns the correct ipaddress also.

Double check you can also browse your site using external address from your server itself.

I had a plugin that was blocking my own server. When it runs scheduled task its not handled internaly it goes out to the www than back into therver itself.

I hope that makes some sense.

My problems were as follows.

And assuming you are ssl

In settings > store make sure ssl is checked and store url has https not http and strire name is not a web address

then in all settings makesure force ssl is true

After this i found that in Windows host file had an entry to point to an old server deleted these

Then another time i had noip filter (addon) which was blocking spain where my server is located added my server ip to the allow list this was another reason shed tasks stopped

I hope this helps you troubleshoot your issue.🤪