Я использую Autofac с WCF. Мой сервис (ExportWebService) должен зависеть от зависимостей (ExportService). Установка Я, ApplicationStart сделать это:Autofac - Область экземпляра WCF
builder.Register(c => new ExportWebService(c.Resolve<ExportService>()));
Но когда я делаю это я получаю ошибку:
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.
Я также попытался:
builder.RegisterType<ExportWebService>().InstancePerHttpRequest();
В моей службы у меня есть :
public ExportService ExportService
{
get;
set;
}
public ExportWebService(ExportService exportService)
{
ExportService = exportService;
}
Любая идея, что есть w Ронг здесь?
Я фактически изменил его на InstancePerLifetimeScope() на основе следующего: https://groups.google.com/forum/#!msg/autofac/vPrvd0RtOtM/MKuGueLmMpEJ, и теперь он работает. – user472292