Performing recurrent tasks every 4 day

Hi, I’m developing an application. In this application I’m using SignalR for sending notification to users. So I want to notify users each 4 day in week. What’s your idea? Should I use Hangfire in my Hub? Or using it inside Global.asax?
Actually I used my recurring job in my hub this way:

public void SendNotificationDaily()
   RecurringJob.AddOrUpdate(() => CallMethod(), Cron.Minutely);

But it dose not perform the job, after some debugging I saw this exception for each job:


No parameterless constructor defined for this object.

System.MissingMethodException: No parameterless constructor defined for this object.
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at Hangfire.JobActivator.ActivateJob(Type jobType)
   at Hangfire.Common.Job.Activate(JobActivator activator)

Any Idea?
Thanks in advance.

One more thing: I’m using DI container and Custom Dependency resolver instead of default signalR dependency resolver:

public class StructureMapDependencyResolver : DefaultDependencyResolver
        private readonly IContainer _container;
        public StructureMapDependencyResolver(IContainer container)
            if (container == null)
                throw new ArgumentNullException("container");
            _container = container;
        public override object GetService(Type serviceType)
            return !serviceType.IsAbstract && !serviceType.IsInterface && serviceType.IsClass
                               ? _container.GetInstance(serviceType)
                               : (_container.TryGetInstance(serviceType) ?? base.GetService(serviceType));
        public override IEnumerable<object> GetServices(Type serviceType)
            return _container.GetAllInstances(serviceType).Cast<object>().Concat(base.GetServices(serviceType));

“No parameterless constructor defined for this object.” exception says that a class containing the CallMethod method does not have a parameterless constructor. To solve a problem, consider to plug in your IoC container (here is StructureMap integration). Check also this and this documentation topics.