c# - 使用 DirectoryEntry / DirectorySearcher 实例化域
问题描述
我想Domain
通过DirectoryEntry
. 理想情况下,像 -
private static DirectoryEntry MakeDirectoryEntry(string target)
{
return new DirectoryEntry(target)
{
AuthenticationType = AuthenticationTypes.Secure | AuthenticationTypes.SecureSocketsLayer
};
}
private static Domain GetDomain(string path)
{
var entry = MakeDirectoryEntry(path);
var searcher = new DirectorySearcher(entry);
// what to put here? cannot use Domain.GetDomain
return null;
}
我不能使用Domain.GetDomain
,因为默认情况下它通过端口389(默认的非 SSL LDAP 端口)进行通信,并且我将在这个远程端口被客户端机器阻止作为出站防火墙规则的环境中工作.
有人知道如何在Domain
不利用的情况下以某种方式实例化 aDomain.GetDomain(DirectoryContext)
吗?
解决方案
推荐阅读
- c++ - 如何在使用 CreateProcess 创建的进程上安装挂钩?
- usb - STML4 USB 虚拟串口
- javascript - 使用 __webpack_require__ 语法在生成的 js 中无法解析 WebPack 依赖项
- javascript - iOS Safari javascript 录音
- swift - CAGradientLayer 定位负值
- java - 自定义 sonarqube 插件 - 代理服务
- javascript - 如何编辑羽毛生成的服务
- aspnetboilerplate - 如何使用 ABP 模板从 scss 文件升级 css 文件 - ASP.NET MVC 5(模块零 - MPA - 3.6)?
- spring-boot - Spring Boot 应用程序未识别控制器和存储库 bean
- pyspark - 来自 Python 字典的 PySpark 数据框,没有 Pandas