afedyanin
10/12/2017 - 10:06 AM

WCF & Autofac

WCF integration for both clients and services requires the Autofac.Wcf NuGet package

http://docs.autofac.org/en/latest/integration/wcf.html

<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true">
  <serviceActivations>
    <add factory="Autofac.Integration.Wcf.AutofacServiceHostFactory, Autofac.Integration.Wcf"
         relativeAddress="~/Service1.svc"
         service="TestService.Service1, TestService" />
  </serviceActivations>
</serviceHostingEnvironment>
var builder = new ContainerBuilder();
builder.RegisterType<Service1>();
AutofacHostFactory.Container = builder.Build();