我試圖使用PrincipalContext對我正在開發一個web服務。我已經在不同的應用程序中使用Web服務器上的表單身份驗證,並且工作正常。PrincipalContext不連接
,我recieving的錯誤是:
System.DirectoryServices.AccountManagement.PrincipalServerDownException: The server could not be contacted. ---> System.DirectoryServices.Protocols.LdapException: The LDAP server is unavailable.
at System.DirectoryServices.Protocols.LdapConnection.Connect()
at System.DirectoryServices.Protocols.LdapConnection.SendRequestHelper(DirectoryRequest request, Int32& messageID)
at System.DirectoryServices.Protocols.LdapConnection.SendRequest(DirectoryRequest request, TimeSpan requestTimeout)
at System.DirectoryServices.Protocols.LdapConnection.SendRequest(DirectoryRequest request)
at System.DirectoryServices.AccountManagement.PrincipalContext.ReadServerConfig(String serverName, ServerProperties& properties)
--- End of inner exception stack trace ---
at System.DirectoryServices.AccountManagement.PrincipalContext.ReadServerConfig(String serverName, ServerProperties& properties)
at System.DirectoryServices.AccountManagement.PrincipalContext.DoServerVerifyAndPropRetrieval()
at System.DirectoryServices.AccountManagement.PrincipalContext..ctor(ContextType contextType, String name, String container, ContextOptions options, String userName, String password)
at System.DirectoryServices.AccountManagement.PrincipalContext..ctor(ContextType contextType, String name, String container, String userName, String password)
at webService.Service1.ValidUser(String sUserName) in E:\Development\CSharpApps\Desktop\OrgChart\webService\Service1.asmx.cs:line 158
我們的Web服務器是在DMZ和訪問,通過防火牆的域。例如,我正在使用端口信息等。
這個工程使用的IP從我的開發中,但它是在防火牆內。 我發送給它的IP信息與我在Web表單身份驗證中使用的相同。
PrincipalContext ctx = new PrincipalContext(ContextType.Domain, "192.168.1.1:389", "dc=doodlie,dc=com",@"doodlie\admin","doodliesquat");
一個類似的問題在這裏:http://stackoverflow.com/questions/1023489/error-while-trying-to-connect-ad-using-ldap-connection – mmcglynn