基本上我可以像这样注册一项服务。
Container.Register(Component.For<IMyService>()
.AsWcfClient(new DefaultClientModel() {
Endpoint = WcfEndpoint
.BoundTo(new NetNamedPipeBinding())
.At("net.pipe://localhost/MyService") })
.LifeStyle.PerWebRequest);
但我不知道如何用类似的配置注册我的所有服务。
我希望运行的是这个......
Container.Register(
AllTypes.FromAssemblyNamed("My.Server.MyContracts")
.Pick().If(x => x.Name.EndsWith("Service"))
.Configure(configurer => configurer.Named(configurer.Implementation.Name)
.AsWcfClient(new DefaultClientModel
{
Endpoint = WcfEndpoint.BoundTo(new NetNamedPipeBinding())
.At(string.Format("net.pipe://localhost/{0}", configurer.Named(configurer.Implementation.Name)).Substring(1))
}))
.LifestylePerWebRequest()
);
如何将所有服务注册为 wcf 客户端?