Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected IService CreateProxy(Uri serviceUri, int sendReceiveTimeout)
- {
- bool isHttps = (serviceUri.Scheme == Uri.UriSchemeHttps);
- EndpointAddress address = new EndpointAddress(serviceUri);
- var binding = new BasicHttpBinding(isHttps ? BasicHttpSecurityMode.Transport : BasicHttpSecurityMode.None);
- binding.SendTimeout = TimeSpan.FromSeconds(sendReceiveTimeout);
- binding.ReceiveTimeout = TimeSpan.FromSeconds(sendReceiveTimeout);
- binding.MaxReceivedMessageSize = Int32.MaxValue;
- binding.ReaderQuotas.MaxStringContentLength = Int32.MaxValue;
- var channelFactory = new ChannelFactory<IService>(binding, address);
- IService proxy = channelFactory.CreateChannel();
- return proxy;
- }
- IService client = CreateProxy(..., ...)
- ServiceClient client = new ServiceClient();
Add Comment
Please, Sign In to add comment