title: ASP.NET 5 (VNext) Autofac Instance per Request
body: <p>I'm playing around with ASP.NET vNext and I'd like to utilize <code>InstancePerRequest</code> for some of my registrations, e.g <code>MyDbContext</code> would be one example.</p>
  
  <p>I've got <code>Autofac</code> running using <code>InstancePerLifetimeScope</code> for these dependencies. Which works....</p>
  
  <p>But as soon as I change over to use <code>InstancePerRequest</code> I get this common error:</p>
  
  <blockquote>
    <p>DependencyResolutionException: 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 requested 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>
  </blockquote>
  
  <p>I've read the Autofac help docs around this.... but I'm not sure how to set up the "request lifetime scope" which is causing this exception.</p>
  
  <p>Has anyone set up an ASP.NET 5 web app integrating Autofac including <code>InstancePerRequest</code>?</p>