J'ai une application client/serveur qui doit utiliser .NET Remoting (pas WCF car le projet utilise Framework 2)..NET2.0 Remoting - Pourquoi l'enregistrement d'un clientChannel est-il nécessaire?
Le code suivant (copié fortement de MSDN) fonctionne:
_clientChannel = new IpcClientChannel();
ChannelServices.RegisterChannel(_clientChannel, false);
IMyObject myObject= (IMyObject)
Activator.GetObject(typeof(IMyObject),
"ipc://MyServer/Address");
if (myObject.Equals(null))
Console.WriteLine("Error: unable to locate server.");
else
returnString = myObject.SomeMethod();
ChannelServices.UnregisterChannel(_clientChannel);
Mais qu'est-ce que ces trois lignes font?
_clientChannel = new IpcClientChannel();
ChannelServices.RegisterChannel(_clientChannel, false);
...
ChannelServices.UnregisterChannel(_clientChannel);
_clientChannel ne peut être utilisé par la suite dans le code de travail. Le code de travail semble également fonctionner sans ces trois lignes. Puis-je me débarrasser d'eux sans perdre la fonctionnalité?