Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a Windows 2008 R2 Web Server (test) which is added to Active Directory domain.

I have an application using AD searching features but, it does not work until I specify in code the credentials for an AD user.

Any idea how to configure the server to give it permissions for accessing AD? (I thought that adding it to domain will do that, however it hasn't.)

share|improve this question

1 Answer 1

up vote 1 down vote accepted

By default your application uses the account of the computer where your web server is installed to access AD and search should work in this case. But this behavior can be overridden by enabling impersonation in your application or specifying custom account for application pool that is used for your application.

Have you enabled impersonation or have your changed the application pool account?

share|improve this answer
    
.NET Impersonation was a way to go! THX! :-) –  XXs Dec 22 '11 at 10:00
    
Uhm, it worked for a while and now it's giving mystic "Runtime Error" –  XXs Dec 22 '11 at 10:04
    
Maybe you didn't dispose correctly resources. Do you use System.DirectoryServices namespace to search in AD? –  begemot Dec 22 '11 at 10:11
    
Yes I use System.DirectoryServices. Well I don't think I dispose it bad way cause it works on IIs express localy, and on test server it runs well too if I specify my user and passowrd in DirectoryEntry constructor. –  XXs Dec 22 '11 at 12:34
    
@XXs, I guess you are impersonating a fixed identity right now (msdn.microsoft.com/en-us/library/ff647404.aspx), then you may consider disable impersonation and instead change the application pool identity to a domain account that has access to AD. After that you don't need to provide user and password in DirectoryEntry constructor. About the runtime error, it must be caused by another thing, which you should ask as a new question. –  Lex Li Dec 27 '11 at 5:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.