title: Autofac error - No scope with a Tag matching 'AutofacWebRequest' is visible from the scope in which the instance was requested
body: <p>In one of my web applications, I have a web service that is using Autofac, the svc file is as follows:</p>
  
  <pre><code>&lt;%@ ServiceHost Language="C#" Debug="true" 
  Service="MyApp.WebServices.Contracts.Interfaces.IMyWebService, MyApp.WebServices.Contracts" 
  Factory="Autofac.Integration.Wcf.AutofacServiceHostFactory, Autofac.Integration.Wcf" %&gt;
  </code></pre>
  
  <p>I register the dependencies for my web service application like this:</p>
  
  <pre><code>public class IocConfig
  {        
      public static void RegisterDependencies()
      {
          var builder = new ContainerBuilder();            
  
          //web services
          builder.RegisterType&lt;MyWebService&gt;().As&lt;IMyWebService&gt;().InstancePerLifetimeScope();
  
          var container = builder.Build();
  
          AutofacHostFactory.Container = container;            
      }
  }
  </code></pre>
  
  <p>From another web application, I want to connect to those services also using Autofac, so I register the dependencies like:</p>
  
  <pre><code>public class IocConfig
  {
      //Ioc dependencies for frontend application
      public static void RegisterDependencies()
      {
          var builder = new ContainerBuilder();
  
          builder.RegisterControllers(typeof(MvcApplication).Assembly);
  
          builder.RegisterModule&lt;AutofacWebTypesModule&gt;();
  
          builder
              .Register(c =&gt; new ChannelFactory&lt;ISomeWebService&gt;(
                  new BasicHttpBinding(),
                  new EndpointAddress("http://localhost/MyApp.WebServices/MyWebService.svc")))
              .InstancePerLifetimeScope();
  
          //register service proxies
          builder.Register(c =&gt; c.Resolve&lt;ChannelFactory&lt;IMyWebService&gt;&gt;().CreateChannel())
              .As&lt;IMyWebService&gt;()
              .UseWcfSafeRelease();
  
          var container = builder.Build();
          DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
      }
  }
  </code></pre>
  
  <p>Inside one of the controllers, I do the following:</p>
  
  <pre><code>public SomeController(IMyWebService myServiceProxy) 
      {
          _myServiceProxy = myServiceProxy;
  
          var response =_myServiceProxy.CallSomeMethod(new Request()
          {
              EmailAddress = "test@test.com"
          });
      }
  </code></pre>
  
  <p>The myServiceProxy of type IMyWebService is being resolved, I see that it is a transparent proxy, but when I call the "CallSomeMethod" I get an error:</p>
  
  <p><strong>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.</strong></p>
  
  <p>What am I doing wrong here? Thanks! </p>