How to determine if a remote access channel is registered

In my ASP.NET application, I have a line in the start event of a global application that sets up a remote client channel by calling RemotingConfiguration.Configure ().

This works well the first time, but when my web application is processed, the application launch event fires again, raising the following remote access exception:

Error deleting configuration with exception "System.Runtime.Remoting.RemotingException: tcp channel is already registered.

I would like to determine if the channel is configured so that I can avoid this exception.

+5
source share
3 answers

.

, , RemotingConfiguration.Configure(), . - , , .

, , , , , .

RemotingConfiguration.Configure(appConfig, false);

// do this to unregister the channel
IChannel[] regChannels = ChannelServices.RegisteredChannels;
IChannel channel = (IChannel)ChannelServices.GetChannel(regChannels[0].ChannelName);

ChannelServices.UnregisterChannel(channel);

RemotingConfiguration.Configure(appConfig, false); // this is just a test to see if we get an error

, ,

+4

, , ?

, , , .NET Remoting WCF.

0

All Articles