I'm using Autofac with WCF. My service (ExportWebService) needs to take in a dependancy (ExportService). I setup the ApplicationStart to do this:
builder.Register(c => new ExportWebService(c.Resolve<ExportService>()));
But when I do so I get the error:
No scope with a Tag matching 'httpRequest' 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.
I've also tried:
builder.RegisterType<ExportWebService>().InstancePerHttpRequest();
In my service I have:
public ExportService ExportService
{
get;
set;
}
public ExportWebService(ExportService exportService)
{
ExportService = exportService;
}
Any idea what is wrong here?