try { String endPointAddr = "net.tcp://localhost:8000/MyService"; NetTcpBinding tcpBinding = new NetTcpBinding(); tcpBinding.TransactionFlow = false; tcpBinding.Security.Transport.ProtectionLevel = System.Net.Security.ProtectionLevel.EncryptAndSign; tcpBinding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Windows; tcpBinding.Security.Mode = SecurityMode.None;
EndpointAddress endpointAddress = new EndpointAddress(endPointAddr);
Console.WriteLine("::::: WCF Service Demo :::::");
Console.WriteLine("Attempt to connect to: " + endPointAddr);
ChannelFactory<IServices> WCF = new ChannelFactory<IServices>(tcpBinding, endpointAddress);
IServices proxy = WCF.CreateChannel();
using (WCF as IDisposable)
{
Console.WriteLine("Connected to: " + endPointAddr);
Dictionary<long, DATALINK> dicDataLink = proxy.getDataLink();
lblCTRGData.Text = dicTRGDataLink.Count.ToString();
}
}
catch (Exception ex)
{
lblCTRGData.Text = ex.Message.ToString();
}
Console.ReadLine();
this code run fluently if disctionary has 50 to 100 records but records is greqater than that erron has been occured The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state