コンソール アプリケーションを介してポート 636 (セキュア) を使用して次のコードを実行すると、正常に動作しますが、ASP.Net Web サイトを介して実行すると失敗します。
DirectoryEntry authServer = new DirectoryEntry(@"LDAP://zxxx.cf.ac.uk:636", "", "", AuthenticationTypes.Anonymous);
DirectorySearcher directorySearch = new DirectorySearcher(authServer, "(CN=sissh6)");
SearchResult result = directorySearch.FindOne();
エラーは次のとおりです。
Problem authenticating : System.Runtime.InteropServices.COMException (0x8007203A):
The server is not operational.
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_AdsObject()
at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne)
at System.DirectoryServices.DirectorySearcher.FindOne()
非セキュア (ポート 636 なし) を使用すると問題はなくなりますが、最終的な解決策はセキュアでなければなりません。
セキュリティで保護されたバージョンがコンソール アプリケーションでは機能するのに、asp.net では機能しないのはなぜですか?