AnsweredAssumed Answered

OSIsoft.AF.PI.PIException: [-11068] Failed to get primary archive

Question asked by RobBowman on May 28, 2017
Latest reply on May 28, 2017 by RobBowman

Hi,

 

I have a C# WPF app that currently selects Pi points and displays attributes in a grid control. I'm no trying to add functionality to create new Pi Points. I ran into an error and so resorted to creating a simple unit test that executes the following code I pulled from OsiSoft's GitHub repo (https://github.com/osisoft/PI-AF-SDK-Basic-Samples/blob/master/ExamplesLibrary/PIPointExamples/CreatePIPointsExample.cs ):

 

=============

PIServers piServers = new PIServers();

PIServer piServer = piServers["<AFSERVER>"];

 

// Use PICommonPointAttributes so we don't have to remember the strings for point attributes.

string floatpoint = "sample_floatpoint";

Dictionary<string, object> floatpoint_attributes = new Dictionary<string, object>();

floatpoint_attributes.Add(PICommonPointAttributes.PointClassName, "classic");

floatpoint_attributes.Add(PICommonPointAttributes.Descriptor, "Hello floating world");

floatpoint_attributes.Add(PICommonPointAttributes.PointType, "float32");

 

string digitalpoint = "sample_digitalpoint";

Dictionary<string, object> digitalpoint_attributes = new Dictionary<string, object>();

digitalpoint_attributes.Add(PICommonPointAttributes.PointClassName, "classic");

digitalpoint_attributes.Add(PICommonPointAttributes.Descriptor, "Hello digital world");

digitalpoint_attributes.Add(PICommonPointAttributes.PointType, "digital");

digitalpoint_attributes.Add(PICommonPointAttributes.DigitalSetName, "modes");

 

Dictionary<string, IDictionary<string, object>> pointDict = new Dictionary<string, IDictionary<string, object>>();

pointDict.Add(floatpoint, floatpoint_attributes);

pointDict.Add(digitalpoint, digitalpoint_attributes);

 

AFListResults<string, PIPoint> results = piServer.CreatePIPoints(pointDict);

===========

 

Trouble is, when I query the result collection, I find the following error:

System.ArgumentException: [-11068] Failed to get primary archive

Parameter name: FatalError ---> OSIsoft.AF.PI.PIException: [-11068] Failed to get primary archive

 

What do I need to do to resolve please?

Outcomes