public static void RegisterWcfClient <TInterface>(string endpoint, BasicHttpBinding binding) { if (!wcfEnabled) { Resolver.Container.AddFacility <WcfFacility>(f => f.CloseTimeout = TimeSpan.Zero); wcfEnabled = true; } Resolver.Container .Register(WcfClient.ForChannels( new DefaultClientModel() { Endpoint = WcfEndpoint.ForContract(typeof(TInterface)) .BoundTo(binding ?? new BasicHttpBinding()) .At(endpoint) })); }
public void CanCallDuplexChannelAsynchronously() { CallbackService callbackService = new CallbackService(); IWindsorContainer localContainer = new WindsorContainer(); localContainer.AddFacility <WcfFacility>(); DuplexClientModel model = new DuplexClientModel { Endpoint = WcfEndpoint.ForContract <IServiceWithCallback>() .BoundTo(new NetTcpBinding()) .At("net.tcp://localhost/ServiceWithCallback") }.Callback(callbackService); localContainer.Register(WcfClient.ForChannels(model)); IServiceWithCallback proxy = localContainer.Resolve <IServiceWithCallback>(); proxy.BeginWcfCall(p => p.DoSomething(21)).End(); Assert.AreEqual(42, callbackService.ValueFromTheOtherSide); }