The error message indicates that your AF Client machine doesn't have the appropriate permission on the PI Data Archive. Please ensure that you have the appropriate mappings or trust on the PI Data Archive. For more information on how to create these. Please see
What are you developing? Desktop app? Web App?
You are getting this error because the account which is running your PI AF SDK code does not have authorization in order to get PI data. Probably the domain account running PI System Explorer and the account running your custom PI AF SDK are not the same.
My suggestion is to try to connect again using PSE and your application and review PI Message Logs. You should see which domain account each client was running under.
Finally, for testing purposes, you can use PIServer.Connect(NetworkCredentials) overload. The username and password are inputs of this method but note that this is not considered the best practice. Ideally, PI AF SDK should use the credentials of the domain account which is running your application.
Hope it helps!
2 of 2 people found this helpful
Thanks for contacting OSIsoft Tech Support. I had the privilege to assist you with this issue.
To summarize our troubleshooting, you were using the local Windows account, and attempting to authenticate using the Windows Integrated Security. The authentication was failing, which is why you were challenged to enter your domain credential when you were trying to access PI AF and PI Data Archive.
The issue was resolved by adding a trust with your machine IP address in SMT >> Security >> Mappings&Trusts >> Trusts tab.
Thank you again for contacting us!