I'm attmempting to hook a client up to the server via remoting. The client code is an ASP.NET app and I'm running through VS2008. The client remoting code is the following:
EmailEnableGroupsWrapper.EmailEnableGroups service;
TcpChannel channel = new TcpChannel();
//ChannelServices.UnregisterChannel(channel);
try
{
ChannelServices.RegisterChannel(channel, false);
} catch (RemotingException re) {
Console.WriteLine(re.StackTrace);
ChannelServices.UnregisterChannel(channel);
ChannelServices.RegisterChannel(channel, false);
}
ActivatedClientTypeEntry acte = new ActivatedClientTypeEntry(typeof(EmailEnableGroupsWrapper.EmailEnableGroups), "tcp://servername:portnumber/RemoteEnableEmailGroups");
RemotingConfiguration.RegisterActivatedClientType(acte);
service = new EmailEnableGroupsWrapper.EmailEnableGroups();
service.EmailEnableGroupWithGroupName(groupName);
When I get to "ChannelServices.RegisterChannel(channel, false);" it throws a remoting exception of "The channel 'tcp' is already registered". As you can see above, the exception is caught and then I try to call "ChannelServices.UnregisterChannel(channel);" where I then get an error of "The channel 'tcp is not registered with remoting services".
This is enough to drive a man insane.
Anyone know where I am going wrong? There is NO other remoting code being called anywhere in the app, nor is this code being called previously by anything. There's nothing in the configuration about the 'tcp' channel.
Thanks in advance,
Andy