I need to add named pipe bindings to service hosted in IIS.
I am going thru steps listed on WcfIntegration wiki page, but cannot find there anything about endpoints configuration.
When creating ServiceHost mannualty in Console applications I do something like:
using (IContainer container = builder.Build())
{
ServiceHost host = new ServiceHost(typeof(ProblemsRepositoryService.ProblemsRepositoryImpl), address);
host.AddServiceEndpoint(typeof(IProblemsRepository), new NetNamedPipeBinding(), string.Empty);
host.AddDependencyInjectionBehavior<IProblemsRepository>(container);
//host.Description.Behaviors.Add(new ServiceMetadataBehavior { HttpGetEnabled = true, HttpGetUrl = address });
host.Open();
Console.WriteLine("The host has been opened. Press enter to close");
Console.ReadLine();
host.Close();
Environment.Exit(0);
}
How can I set binding settings when hosting in IIS?
My current code listing:
public static class AppStart
{
public static void AppInitialize()
{
builder.RegisterType<ProblemsRepositoryImpl>();
using (IContainer container = builder.Build())
{
AutofacHostFactory.Container = container;
var factory = new AutofacServiceHostFactory();
RouteTable.Routes.Add(new ServiceRoute("ProblemsRepositoryImpl", factory, typeof(ProblemsRepositoryImpl)));
}
}
}
I've solved this configuring endpoints from web.config:
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true">
<serviceActivations>
<add factory="Autofac.Integration.Wcf.AutofacServiceHostFactory"
relativeAddress="~/ProblemsRepositoryImpl.svc"
service="ProblemsRepositoryService.ProblemsRepositoryImpl" />
</serviceActivations>
</serviceHostingEnvironment>
<services>
<service name="ProblemsRepositoryService.ProblemsRepositoryImpl" behaviorConfiguration="debugEnabled">
<endpoint contract="ProblemsRepositoryService.Interfaces.IProblemsRepository"
binding="netNamedPipeBinding" address="net.pipe://localhost/ProblemsRepository/ProblemsRepository.svc"/>
</service>
</services>