I created a service that validates credentials in Active Directory using System.DirectoryServices.AccountManagement. I need to check the credentials for the local domain as well as the trusted domain. The response time for credential verification is fast for both the local and the trusted domain when running on my computer. When I transfer this service to our server, the response of the local domain is fast, the response of the trusted domain is very slow (20-30 seconds).
I also found that if I change the domain name in PrincipalContext from NetBios to DNS, it fixes a performance problem on the server.
Here are some examples.
PrincipalContext context = new PrincipalContext(ContextType.Domain, sNetBiosName)
context.ValidateCredentials(sUsername, sPassword)
On the server, the above will take 20-30 seconds using the NetBios name
PrincipalContext context = new PrincipalContext(ContextType.Domain, sDNSName)
context.ValidateCredentials(sUsername, sPassword)
Using a DNS name, the response is 0-2 seconds
Any ideas on what you need to configure on the server to speed this up using the NetBios name?
source
share