Changing default binding setting in IIS Hosted Services.

92 views
Skip to first unread message

achered...@gmail.com

unread,
Aug 22, 2013, 11:39:23 AM8/22/13
to aut...@googlegroups.com
Dear all,

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)));

}
}
}

achered...@gmail.com

unread,
Aug 23, 2013, 6:52:59 AM8/23/13
to aut...@googlegroups.com, achered...@gmail.com

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>

Reply all
Reply to author
Forward
0 new messages