Developer technologies | .NET | Other
Microsoft Technologies based on the .NET software framework. Miscellaneous topics that do not fit into specific categories.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello,
I have to implement wcf client reconnection.
Here requirement 1:Service is not up
var inst = new InstanceContext(new TestCallBack(this));
var b = new NetTcpBinding();
b.SendTimeout = new TimeSpan(1, 59, 59);
b.ReceiveTimeout = new TimeSpan(1, 59, 59);
b.Security.Mode = SecurityMode.None;
b.MaxBufferPoolSize = int.MaxValue;
b.MaxBufferSize = int.MaxValue;
b.MaxReceivedMessageSize = int.MaxValue;
b.ReliableSession.Enabled = true;
b.ReliableSession.InactivityTimeout = new TimeSpan(1, 59, 59);
var Channel = new DuplexChannelFactory<ITest>(inst, b);
var epAddress = new EndpointAddress("net.tcp://localhost:8485/Service/Test");
Itest test = Channel.CreateChannel(epAddress);
**test?.Initialize();**//Hangs here
When service is not available i am trying to create the channel.Then i am trying to call Initialize method.It hangs there.Its not returning any failure or anything.
Is there anyway to make this failure with no connection error or how can i check before calling the method is the channel is opened and ready for the communcation.
Please help me to solve this.Attached the code snippet.