AnsweredAssumed Answered

AF SDK Duplicate Exception

Question asked by osidet on May 18, 2015
Latest reply on May 19, 2015 by dng

I have two C# processes, each trying to access a PI collective via the AF SDK (version 2014 R2 SP1). The default autoadd options are set in PISystems. Suppose the IPs for both collective members are and respectively.


When the first process tries to connect to, it succeeds, and it resolves the name of the PI server to the collective name (in this case picollective-dev).


When the second process tries to connect:

- If I tell it to connect to, it has no problem.

- If I tell it to connect to, it will fail with the exception: "Service list already contains an entry with a matching server path."


Here's what I think is happening:

- The AutoAdd feature is working by doing a string based comparison against the server names given to it before resolution. Since it hasn't seen, it assumes that it isn't present, and autoadd then tries to add it.

- In order to add it, it must resolve the IP to a name. The name it find already exists in the server list, therefore an exception is thrown.


Quick dump of code (pulled from various parts of a class and incomplete, but hopefully illustrative):


            // From constructor

            m_system = new OSIsoft.AF.PISystems(true);

            OSIsoft.AF.PISystems.DirectoryOptions = OSIsoft.AF.PISystems.AFDirectoryOptions.Default;


            // In method connect(string networkAddress)

            var piServers = OSIsoft.AF.PI.PIServers.GetPIServers(m_system.DefaultPISystem);


            OSIsoft.AF.PI.PIServer piServer = piServers[networkAddress];


To clarify - I don't care which member I actually end up connecting to. But I would like the connection attempt to succeed regardless of which IP I use.


Any help appreciated.