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();
ce code execute couramment si le dictionnaire a 50 à 100 dossiers, mais les enregistrements est supérieur à cette erreur a été L'objet de communication System.ServiceModel.Channels.ServiceChannel ne peut pas être utilisé pour la communication car il est en état de panneL'objet de communication, System.ServiceModel.Channels.ServiceChannel, ne peut pas être utilisé pour la communication car il est dans l'état Faulted
Et votre question est? Êtes-vous en train de coder un appel de service avec le proxy dans une instruction using, et le service a jeté une erreur? – Paddy