public static void SetClientBaseAddress <T>(this DuplexClientBase <T> proxy) where T : class { lock (typeof(WsDualProxyHelper)) { int portNumber = FindPort(); SetClientBaseAddress(proxy, portNumber); proxy.Open(); } }
public static I CreateInstance <S, I, C>(C callback) where I : class where S : class, I { DuplexClientBase <I, C> .VerifyCallback(); InstanceContext <C> context = new InstanceContext <C>(callback); return(CreateInstance <S, I, C>(context)); }
public static void SetClientBaseAddress <T>(this DuplexClientBase <T> proxy, int port) where T : class { if (proxy.State == CommunicationState.Opened) { throw new InvalidOperationException("Proxy is already opened"); } WSDualHttpBinding binding = proxy.Endpoint.Binding as WSDualHttpBinding; Debug.Assert(binding != null); binding.ClientBaseAddress = new Uri("http://localhost:" + port + "/"); }
static DuplexChannelFactory() { DuplexClientBase <T, C> .VerifyCallback(); }