title: ASP .Net 4 Web Api RC + Autofac manual resolving
body: <p>I'm trying to use depedency resolver inside a Web Api method. This worked fine and works fine with classic ASP.NET MVC with the DepedencyResolver.GetService() </p>
  
  <p>But I can't get this to work inside WepApi methods. </p>
  
  <p>My registration register all instances as InstancePerApiRequest and if I add any of all the  types I have registred in my bootstrapper on the constructor of my WebAPiConroller thay inject fine but not anymore when calling them inside. </p>
  
  <p>Like this in my say Get Method</p>
  
  <pre><code>var userRepository = (IUserRepositoryu)GlobalConfiguration
         .Configuration.DependencyResolver.GetService(typeof(IUserRepository));
  </code></pre>
  
  <p>I got the no scope WebRequest error. The strange thing is that it worked fine in Beta before they change it all to the GlobalConfiguration. </p>
  
  <p><strong>So my question is, how can I activate my Autofac registered assemblies in the lifetime scope of my webAPi as before</strong>? </p>
  
  <p>My error:</p>
  
  <p>"No scope with a Tag matching 'AutofacWebRequest' is visible from the scope in which the instance was requested. This generally indicates that a component registered as per-HTTP request is being reqested by a SingleInstance() component (or a similar scenario.) Under the web integration always request dependencies from the DependencyResolver.Current or ILifetimeScopeProvider.RequestLifetime, never from the container itself."</p>
  
  <pre><code> var resolver = new AutofacWebApiDependencyResolver(container);
   configuration.DependencyResolver = resolver;
  </code></pre>