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();
этот код выполняется бегло, если в словаре содержится от 50 до 100 записей, но записей больше, чем произошла ошибка. Объект связи System.ServiceModel.Channels.ServiceChannel не может использоваться для связи, поскольку он находится в состоянии Failed *