I get this error whenever I try to have more than one PeerChannel node in the same App Domain.
I am able to have multiple PeerChannel nodes running on the same machine if they are in separate EXEs, each with own PeerChannel node (each specifies the same mesh but a different binding port). That works fine.
But as soon as I try to have 2 PeerChannel nodes running in the same EXE, or in the same ASP.NET-hosted container, I get this error (stack trace below). Despite the message, I don't see any conflicting Uris, since I'm using a differnet port number for each node. And, the exact code for each runs fine if separated into individual EXEs. They only seem to be unhappy in the same AppDomain. Can anyone shed light on why this is
Thanks,
David Pallmann, Principal Consultant, Neudesic
System.InvalidOperationException was unhandled
Message="An existing PeerNode exists for this Uri with a conflicting configuration."
Source="System.ServiceModel"
StackTrace:
at System.ServiceModel.Channels.PeerNodeImplementation.Get(Uri listenUri, Registration registration)
at System.ServiceModel.Channels.PeerChannelFactory.OnCreateChannel[TChannel](EndpointAddress to, Uri via)
at System.ServiceModel.Channels.ChannelFactoryBase.CreateChannel[TChannel](EndpointAddress remoteAddress, Uri via)
at System.ServiceModel.Channels.ServiceChannelFactory.MaybeCreateInnerChannelBinder(IEnumerable`1 supportedChannels, Boolean actuallyCreate, EndpointAddress to, Uri via, IChannelBinder& result)
at System.ServiceModel.Channels.ServiceChannelFactory.CreateInnerChannelBinder(EndpointAddress to, Uri via)
at System.ServiceModel.Channels.ServiceChannelFactory.CreateChannel(Type channelType, EndpointAddress to, Uri via)
at System.ServiceModel.Channels.ServiceChannelFactory.OnCreateChannel[ChannelType](EndpointAddress to, Uri via)
at System.ServiceModel.Channels.ChannelFactoryBase.CreateChannel[TChannel](EndpointAddress remoteAddress)
at System.ServiceModel.ChannelFactory`1.CreateDuplexChannel(InstanceContext inputInstance)
at Neudesic.PubSub.TopicMeshNode.Open(String member, Int32 port, String topic, ReceiveMethod callback) in C:\Dev\NCSA\Neudesic.PubSub.Peer\PubSub\Client.cs:line 316
at Neudesic.PubSub.TopicManager.ConnectToMesh(String subscriberId, Int32 port, String topic, ReceiveMethod callback) in C:\Dev\NCSA\Neudesic.PubSub.Peer\PubSub\Client.cs:line 226
at Neudesic.PubSub.PubSubClient.Connect(String subscriberId, Int32 port, String topic, ReceiveMethod callback) in C:\Dev\NCSA\Neudesic.PubSub.Peer\PubSub\Client.cs:line 80
at Neudesic.Client..ctor() in C:\Dev\NCSA\Neudesic.PubSub.Peer\Client\client.cs:line 48
at Neudesic.App.Main(String[] args) in C:\Dev\NCSA\Neudesic.PubSub.Peer\Client\client.cs:line 23
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

An existing PeerNode exists for this Uri with a conflicting configuration
bneat
sunil2205
I am using the custom peer resolver, and I am specifying a unique port number for each node.
David
Viper_zz
I experienced exact the same problem.
Based on a stack trace:
System.ServiceModel.Channels.PeerNodeImplementation.Get(Uri listenUri, Registration registration)
Cause the problem.
To be more specific:
if (registration.IsCompatible(implementation1)) will return false:
public bool IsCompatible(PeerNodeImplementation peerNode)
{
if (((this.listenUri != peerNode.ListenUri) || (this.port != peerNode.Port)) || ((this.maxReceivedMessageSize > peerNode.MaxReceivedMessageSize) || (this.resolver.GetType() != peerNode.Resolver.GetType())))
{
return false;
}
…
}
It requires that everything in a both peer Node configuration will be the same, including port
I made ports(!) the same for both p2p clients and everything started to work fine within the same AppDomain (exe).
Lzitro
I can imagine several reasons for this that are internal to the PeerChannel. (If this is a duplicate post that is because I do not see the earlier post on the forum.)
1) Try using the custom peer resolver with unique ports on each node.
2) Try tracing down their calls to know what the UR is for listenURI.
3) I have seen this when I run tests too close together. There seems to be some type of lease timing on releasing ports in a mesh when using PNRP, even if you close the channel. Make sure you close the channel in all cases, including crashes.
It would be nice if that error message included the URI it was complaining about.