In my application i have about 50 services that i have to register
using Windsor and WCF facility. I did some customizations for security
and session per call behavior. I am trying to find an elegant way to
setup both the client ant the server configuration without copy/
pasting the code (final three blocks at the bottom of each
configuration).
My current client configuration:
//------------------------------------------------------
var kernel = new WindsorContainer();
IoC.Initialize(kernel);
kernel.Register(Component.For<ILogger>().ImplementedBy<CustomLogger>
());
kernel.Register(Component.For<IChannelFactoryAware>().
ImplementedBy<CustomChannelFactoryAware>());
kernel.AddFacility<WcfFacility>();
WSHttpBinding wsHttpBinding = new WSHttpBinding(SecurityMode.Message);
wsHttpBinding.Security.Message.ClientCredentialType =
MessageCredentialType.UserName;
kernel.Register(Component.For<IService1>()
.ActAs(new DefaultClientModel(WcfEndpoint.BoundTo(wsHttpBinding)
.At("http://localhost:9999/" +
ContractDescription.GetContract(typeof(IService1)).Name))));
kernel.Register(Component.For<IService2>()
.ActAs(new DefaultClientModel(WcfEndpoint.BoundTo(wsHttpBinding)
.At("http://localhost:9999/" +
ContractDescription.GetContract(typeof(IService2)).Name))));
kernel.Register(Component.For<IService3>()
.ActAs(new DefaultClientModel(WcfEndpoint.BoundTo(wsHttpBinding)
.At("http://localhost:9999/" +
ContractDescription.GetContract(typeof(IService3)).Name))));
//------------------------------------------------------
My current server configuration:
//------------------------------------------------------
var kernel = new WindsorContainer();
IoC.Initialize(kernel);
kernel.Register(Component.For<ILogger>().ImplementedBy<ConsoleLogger>
());
kernel.Register(Component.For<IServiceHostBuilder<DefaultServiceModel>>
()
.ImplementedBy<CustomServiceHostBuilder>());
kernel.Register(Component.For<ISessionFactory>()
.Instance(ConfigureDatabaseConnection()));
kernel.Register(Component.For<IServiceBehavior>
().ImplementedBy<SessionPerCallBehavior>());
kernel.AddFacility<WcfFacility>();
WSHttpBinding wsHttpBinding = new WSHttpBinding(SecurityMode.Message);
wsHttpBinding.Security.Message.ClientCredentialType =
MessageCredentialType.UserName;
kernel.Register(Component.For<IService1>().ImplementedBy<Service1>()
.ActAs(new DefaultServiceModel().AddEndpoints(
WcfEndpoint.BoundTo(wsHttpBinding).At("http://localhost:9999/" +
ContractDescription.GetContract(typeof(IService1)).Name))));
kernel.Register(Component.For<IService2>().ImplementedBy<Service2>()
.ActAs(new DefaultServiceModel().AddEndpoints(
WcfEndpoint.BoundTo(wsHttpBinding).At("http://localhost:9999/" +
ContractDescription.GetContract(typeof(IService2)).Name))));
kernel.Register(Component.For<IService3>().ImplementedBy<Service3>()
.ActAs(new DefaultServiceModel().AddEndpoints(
WcfEndpoint.BoundTo(wsHttpBinding).At("http://localhost:9999/" +
ContractDescription.GetContract(typeof(IService3)).Name))));
//------------------------------------------------------
Any pointers are more than welcome.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---