I am trying to register my WCF services with Castle Windsor on my WinForms client using the WCFFacility. I can easily do this one at a time using
container.Register(Component.For<IMyService>()
.AsWcfClient(new DefaultClientModel
{
Endpoint = WcfEndpoint.BoundTo(new BasicHttpBinding { MaxReceivedMessageSize = 3000000 })
.At("http://localhost:51324/MyService.svc")
}));
However I have hundreds so tried to follow this answer
I used this code:
container.Register(
Types
.FromAssemblyContaining<IMyService>()
.Pick()
.If(s => s.Name.EndsWith("Service"))
.Configure(
configurer => configurer.Named(configurer.Implementation.Name)
.AsWcfClient(new DefaultClientModel
{
Endpoint = WcfEndpoint.BoundTo(new BasicHttpBinding { MaxReceivedMessageSize = 3000000 })
.At(string.Format("http://localhost:{0}/{1}.svc", Port, configurer.Name.Substring(1)))
})));
Unfortunately this gives me the following error when trying to resolve my service: "Type MyNamespace.IMyService is abstract. As such, it is not possible to instantiate it as implementation of service 'IMyService'. Did you forget to proxy it?"