title: ServiceStack IServiceGateway in Non Service/Non Controller and IOC
body: <p>I have a console app with hangfire and service stack services into.  Hangfire has its own IOC Adapter Implementations which has been integrated into a Funq adapter.  I'm trying to use an IGatewayService to make calls to an inproc service.  </p>
  
  <p>The gateway is always null.   </p>
  
  <pre><code>public class Tests
  {
      public IServiceGateway gateway { get; set; }
      public Tests()
      {
          gateway =  HostContext.TryResolve&lt;IServiceGateway&gt;(); //tried this along with every type of registration
  
      }
      public void Test3() {
         // I want to use gateway here to call an inproc service
      }
  }
  </code></pre>
  
  <p>I've tried:</p>
  
  <pre><code>Container.Register&lt;IServiceGatewayFactory&gt;(x =&gt; new TestServiceGatewayFactory())
              .ReusedWithin(ReuseScope.None);
  
              Container.Register&lt;Tests&gt;(new Tests() { gateway = Container.Resolve&lt;IServiceGateway&gt;() });
  </code></pre>
  
  <p>And some other non funq adapters and the gateway is always null.  I could create the gateway in the register <code>new TestServiceGateway()</code> but it requires an <code>IRequest</code>.  If I pass null there it won't work either.</p>
  
  <p>The hangfire call is simple:</p>
  
  <pre><code>RecurringJob.AddOrUpdate&lt;Tests&gt;((t) =&gt; t.Test3(), Cron.Yearly(12, 12));
  </code></pre>