Hi All,
I have written a plugin with the normal config page that has 2 buttons that run a couple of tasks. This all works fine.
I am trying to get these tasks to also be triggered by a scheduled task. The Scheduled task gets registered an runs, but throws an error when trying to run the services.
Bit about the project.
I have three files IMYImportService.cs and MYImportService.cs which do the work, and work perfectly when called from the config form. I have a third Serviceschedule.cs that has the schedule stuff in and tries to call the services to do the work.
I hope this explains my problem well enough, and someone can point me in the right direction
Thanks in advance.
Paul
The Error I get is on the Execute() method in Task.cs
Error while running the 'Update MY Stock' schedule task. None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Nop.Plugin.Feed.MYImport.Services.MYUpdateScheduler' can be invoked with the available services and parameters: Cannot resolve parameter 'Nop.Plugin.Feed.MYImport.Services.MYImportService MYImportService' of constructor 'Void .ctor(Nop.Plugin.Feed.MYImport.Services.MYImportService)'.
Autofac.Core.DependencyResolutionException: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Nop.Plugin.Feed.MYImport.Services.MYUpdateScheduler' can be invoked with the available services and parameters: Cannot resolve parameter 'Nop.Plugin.Feed.MYImport.Services.MYImportService MYImportService' of constructor 'Void .ctor(Nop.Plugin.Feed.MYImport.Services.MYImportService)'. at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) at Autofac.Core.Resolving.InstanceLookup.Execute() at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) at Autofac.Core.Resolving.ResolveOperation.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance) at Autofac.ResolutionExtensions.TryResolve(IComponentContext context, Type serviceType, Object& instance) at Nop.Core.Infrastructure.DependencyManagement.ContainerManager.TryResolve(Type serviceType, Object& instance) in c:\..\Libraries\Nop.Core\Infrastructure\DependencyManagement\ContainerManager.cs:line 159 at Nop.Services.Tasks.Task.CreateTask() in c:\..\Libraries\Nop.Services\Tasks\Task.cs:line 42 at Nop.Services.Tasks.Task.Execute() in c:\..\Libraries\Nop.Services\Tasks\Task.cs:line 65