首页 > 解决方案 > Docker 不允许使用 System.DirectoryServices.AccountManagement

问题描述

我的应用程序不断崩溃

        // domain connection
        PrincipalContext LDAPDomain = new PrincipalContext(ContextType.Domain, LDAP_DOMAIN);

        // checking existance of user
        UserPrincipal user = UserPrincipal.FindByIdentity(LDAPDomain, username);

错误消息说

DllNotFoundException: Unable to load DLL 'activeds.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)

该代码在 IIS 中运行时运行良好,但在 Docker 中,我遇到了这个崩溃,我不知道如何解决它。

我做了以下

docker cp C:\Windows\System32\activeds.dll :/C:/Windows/System32

在 Visual Studio 中的构建事件中,(预构建)

XCOPY /Y "C:\Windows\System32\activeds.dll" "$(TargetDir)"

REGSVR32 C:\Windows\System32\activeds.dll(Docker 控制台)

标签: asp.netdockerasp.net-core

解决方案


推荐阅读