Connecting to a PIServer with a domain user

I'm trying to use the AF SDK to connect to a PI Server like this (simplified):

PIServers piServers = new PIServers();
_server = piServers[serverName];



string domain = mydomain;
string username = myusername;
string password = mypassword;


NetworkCredential netCred = new NetworkCredential(username, password, domain);


_server.Connect(netCred);

 

I've mapped the user to the piadmins Identity on the PI Server, but when I try to connect, I get an exception with the message "Cannot connect to the PI Data Archive."

 

In the PI Message Logs I get the following message: "Unsuccessful login  ID: 105. Address: 172.19.30.185. Name: God.Tag.Server.Console.vshost.exe(1748):remote. Credentials used: petter.brodin. Method: Explicit Login. Error: [-12001] Name Not Found in PInt"

 

Is there any reason why this shouldn't work? Is there a better way to approach this when attempting to log in with a domain user?

Parents
  • Hello Petter,

     

    I hope you will forgive me , I have flagged Roger answer as correct instead because Connecting to a PI Data Archive explains very well the several scenarios and is a useful resource for the question: Connecting to a PIServer with a domain user

    , especially:

    // Get the PIServers collection for the current user and default PIServer.
     PIServer myPIServer = new PIServers().["SERVER_NAME"];
    
     // Simple connect with current windows user
     myPIServer.Connect();
     myPIServer.Disconnect();
    
    // Connect and display a credential prompt dialog if current user login fails.
    myPIServer.Connect(true, null);
    

Reply
  • Hello Petter,

     

    I hope you will forgive me , I have flagged Roger answer as correct instead because Connecting to a PI Data Archive explains very well the several scenarios and is a useful resource for the question: Connecting to a PIServer with a domain user

    , especially:

    // Get the PIServers collection for the current user and default PIServer.
     PIServer myPIServer = new PIServers().["SERVER_NAME"];
    
     // Simple connect with current windows user
     myPIServer.Connect();
     myPIServer.Disconnect();
    
    // Connect and display a credential prompt dialog if current user login fails.
    myPIServer.Connect(true, null);
    

Children