9 Replies Latest reply on Aug 28, 2013 3:05 PM by Marcos Vainer Loeff

    AFOperations with PB Component issue


      Hi all,


      I'm having a problem while trying to access AF Attribute Values inside a PB Custom Component (made in C# .NET 4.0).


      After calling the AFOperations.FindAttributes and connecting to de AFDatabase of choice, a warning message is shown at the selection of attributes: "Insufficient privilege to access the PI Server."


      It's strange because looking at the AboutPI-SDK, i'm connected to the piserver as piadmin. So, there is a way to set manually the PI Server for the AFOperations, or get the PI Server from the ProcessBook Interop Lib (i've tried with no success until now).


      Someone have a clue on that?


      Thanks in advance.

        • Re: AFOperations with PB Component issue
          Marcos Vainer Loeff

          Hello Pedro,


          Below there are a few suggestions for you to try:

          1. If you open PI System Explorer with the same user account that you have opened PI ProcessBook, would you receive a similar error when navigating through your tree of elements and its attributes from the same database?
          2. Can you create a trend with the values from an attribute from the same database you are testing?
          3. If you develop a console application with a similar code snippet you used on your PB Custom Component, would you see the same error message?
          4. The last test would be: modify your PB Custom Component and connect to your AF Server using the method Connect(NetworkCredential) and specify the credentials of a domain account that you are sure that it has read access to the PI Server.
          5. Check the content of the ConnectionInfo property from the PISystem object to review how your application is connecting to AF.

          Don’t forget to check the PI Message Logs from the client machine and the PI Server. Also check the Windows Event Viewer to find error messages related to AF.

            • Re: AFOperations with PB Component issue

              Hi Marcos, thanks for the reply.


              Tried out the suggentions, the results:


              1. Yes. But if i manually connect to PI Server  the error disappear.


              2. Yes.


              3. Yes, i'm getting this error with a standalone app.


              4. Tested, doesn't solve the problem.


              5. It returns the info "Name=LASSEPISERVER, Host=lassepiserver, Protocol=Tcp, Port=5457, AccountName=piadmin, TimeOut=00:05:00".


              Looking the log i've found this message, might be the source of the problem:


              26/08/2013 09:18:44,552, , Error, Failed to register a server with pibufss.  [-30701] PIbufss unable to buffer due to internal problems. PIbufss cannot resolve the situation on its own : [-11446] Error retrieving buffered server configuration from the registry: [2] The system cannot find the specified file .. Not able to buffer SDK data. , procbook, , PISDK,,,


              Can it be an enviroment problem?

                • Re: AFOperations with PB Component issue
                  Marcos Vainer Loeff

                  Hello Pedro,


                  Concerning the pibufss error message, I don’t believe it is related to insufficient privileges. In this case, TechSupport is the correct channel to solve this new issue. Would you like to contact them or should I report this issue to them so they could contact you?


                  Back to your original problem, could you please paste here the code snippet you used on your console application? I just want to understand what are you doing exactly.

                    • Re: AFOperations with PB Component issue

                       Hi Marcos,


                      Let me contact techsupport, no problem at all.


                      The test code is basically:

                      AFNamedCollectionList<AFAttribute> attrList = null;
                      PISystems psystems = new PISystems();
                      PISystem psys = psystems.DefaultPISystem;
                      psys.Connect(new System.Net.NetworkCredential("Administrator", "Administrat0r"));
                      AFOperations.FindAttributes(this, psys.Databases.DefaultDatabase, out attrList, true, true, true, false, "");

                      The problem, as i think, is that the AF SDK is not setting the PI Server credentials for the Attribute Find Dialog.



                        • Re: AFOperations with PB Component issue
                          Marcos Vainer Loeff

                          Hello Pedro,


                          Let’s do two more tests. The first one would be to create a new database in AF. Add an element and an attribute with a value. On your code, change the parameter in FindAttributes to search for attributes in this new database. Would you receive the same warning message?



                          AFOperations.FindAttributes(this, psys.Databases["NewDb"], out attrList, true, true, true, false, "");



                           What happens if you try to use the method FindElementAttributes instead of AFOperations.FindAttributes? Below you can find an example to test:



                           AFAttributeList allAttributes = AFAttribute.FindElementAttributes(
                                           psys.Databases.DefaultDatabase,                            //The AFDatabase to search for the requested objects.



                          Please, let us know if you have any question.

                            • Re: AFOperations with PB Component issue
                              David Hearn

                              Since you need to specify credentials to connect to the PI Server, you will need to use PISDK to explicitly create the connection before calling FindAttributes. In your code sample, you are specifying credentials for connecting to the AF Server (PISystem.Connect) which is different than the connection to the PI Server. The AF 2.5 .NET 4 version of the AFSDK has a PIServer.Connect where you can specify the credentials for the PI Server connection and not require the use of the PISDK.

                        • Re: AFOperations with PB Component issue

                          Hi Pedro,


                          It seems that your main issue is related to credentials as David pointed out.


                          I just wanted to note on the PIbufss errors you're seeing, could you clarify the version of your PI-SDK ?


                          PISDK 2012 ( supports buffering and it requires proper set up (see PISDKBuffering.chm) for PI-SDK apps to function properly on writing data through PIBufSS. It seems that the PIBufSS error your seeing is due to PIBufSS service running but it may not have proper permission on the corresponding PIServer.

                            • Re: AFOperations with PB Component issue

                              Hi all,


                              Thanks for the responses. Sorry for the delay, i've been out for a day.


                              Marcos, i tried out the suggestion, but i really need the generic attribute search dialog.


                              David, that's the approach i've been trying. At first i was referencing a different AFSDK assembly version, the PIServer was missing in the lib, and i get running in circles for a while because of that. But at the final i've achieved success.


                              I think the problem may be related to a pi security security issue, for using weak login credentials (with no password), as listed on AF Help - PI Server Connection Problems topic.


                              Eddy, i'm currently using this version. Thanks for the note. i'll  configure it as you said, and post, if necessary, further on.