title: Unity The type does not have an accessible constructor
body: <p>I recently started using unity and It seems to work well except for one place... I did some searching but I did not find anything that I can apply to my code.</p>
  
  <p>Heres the code for register the types:</p>
  
  <pre><code>Container.RegisterType&lt;IVsoCommunicator, VsoCommunicator&gt;();
  Container.RegisterType&lt;IIpxConnection, IpxCommunicator&gt;();
  Container.RegisterType&lt;IConsentService, ConsentService&gt;(new InjectionFactory(p =&gt; new ConsentService(p.Resolve&lt;IIpxConnection&gt;(), p.Resolve&lt;IVsoCommunicator&gt;())));
  Container.RegisterType&lt;ITimer, ConsentStatusPoller&gt;(new InjectionFactory(p =&gt; new ConsentStatusPoller(p.Resolve&lt;IConsentService&gt;())));
  </code></pre>
  
  <p>And the exception:</p>
  
  <pre><code>Resolution of the dependency failed, type = "UserManager.Services.ConsentStatusPoller", name = "(none)".
  Exception occurred while: while resolving.
  
  Exception is: InvalidOperationException - The type IConsentService does not have an accessible constructor.
  
  -----------------------------------------------
  
  At the time of the exception, the container was:
  
  Resolving UserManager.Services.ConsentStatusPoller,(none)
  
  Resolving parameter "consentService" of constructor UserManager.Services.ConsentStatusPoller(UserManager.Services.IConsentService consentService)
  
  Resolving UserManager.Services.IConsentService,(none)
  </code></pre>
  
  <p>What do I do wrong here? First I thought that I had something private but that was not the case</p>
  
  <p>Changed the registration to:</p>
  
  <pre><code>Container.RegisterType&lt;ISettingsConfiguration, SettingsConfiguration&gt;();
  Container.RegisterType&lt;IUnitOfWork, UnitOfWork&gt;();
  Container.RegisterType&lt;IVsoCommunicator, VsoCommunicator&gt;();
  Container.RegisterType&lt;IIpxConnection, IpxCommunicator&gt;();
  Container.RegisterType&lt;IConsentService, ConsentService&gt;();
  Container.RegisterType&lt;ITimer, ConsentStatusPoller&gt;();
  </code></pre>
  
  <p>Consent service:</p>
  
  <pre><code>public interface IConsentService
  {
      void GetConsentReplies();
      void GetConsentSmsUpdates();
  }
  public class ConsentService : IConsentService
  {
      private readonly IIpxConnection _ipx;
      private readonly IVsoCommunicator _vso;
  
      public ConsentService(IIpxConnection ipx, IVsoCommunicator vso)
      {
          _ipx = ipx;
          _vso = vso;
      }
  
      public async void GetConsentReplies()
      {
      }
  
      private void UpdateLocationConsentSmsData(List&lt;IncomingMessage&gt; messages)
      {
  
      }
  
      private void SendConsentMessages(IEnumerable&lt;IncomingMessage&gt; messages)
      {
  
  
      }
  
      private void SaveIpxConsents(IEnumerable&lt;createConsentResponse1&gt; responses)
      {
      }
  
      public async void GetConsentSmsUpdates()
      {
  
      }
  
      private static void SaveConsentSmsUpdates(GetMessageStatusResponse resp)
      {
  
      }
  
  }
  </code></pre>
  
  <p>Consent poller:</p>
  
  <pre><code>public interface ITimer
  {
      void Start(int interval);
  }
  public class ConsentStatusPoller : ITimer
  {
      private readonly IConsentService _consentService;
      readonly Timer _tmr;
  
      public ConsentStatusPoller(IConsentService consentService)
      {
          _consentService = consentService;
          _tmr = new Timer();
          _tmr.Elapsed += _tmr_Elapsed;
      }
  
      void _tmr_Elapsed(object sender, ElapsedEventArgs e)
      {
          _consentService.GetConsentReplies();
          _consentService.GetConsentSmsUpdates();
      }
  
  
  
      public void Start(int interval)
      {
          _tmr.Interval = interval;
          _tmr.Start();
      }
  }
  </code></pre>