We have a situation with Active Directory during project startup:
Environment Information: Central server that has the Main Active Directory server : Windows server 2012 R2 64-bit, IP Address: 192.168.1.10
Office server that has a read only Active Directory server: Windows server 2012 R2 64-bit, IP Address: 192.168.50.10 (this Active directory replicates users & workstations information from the central server). The two server are connected via a DSL network.
Our C# application runs on the office network and the Operator PC (Windows 7 64-bit) is joined to the domain in the office. it has to authenticate users from Active Directory in the Office Server using the following code.
using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, "mydomain.com"))
{
// validate the credentials
bool isValid = pc.ValidateCredentials("username", "password");
Log("Create principal context done");
}
The problem is we have the following errors that appear almost every time we try to run this code:
- The server is not operational
- The server could not be contacted
- The LDAP server is unavailable
In case this code works it take about 1 minutes to finish. Note: this code never fail in our development environment (LAN network with the same IP range 10.0.0.).
Any suggestions?