在烦人的Active Directory位上,我最近几个小时都被困住了.
我想要完成的是通过SSL通过LDAP连接到Active Directory.身份验证类型是匿名的.我正在使用.NET Framework 4.0,C#和Visual Studio 2010.
以下代码应根据各种在线资源工作.但它不断提出令人惊讶的不言自明:'未知错误(0x80005000)'.
DirectoryEntry entry = new DirectoryEntry();
entry.Path = "LDAPS://some.ldap.server:636";
entry.AuthenticationType = AuthenticationTypes.SecureSocketsLayer;
DirectorySearcher searcher = new DirectorySearcher();
searcher.searchRoot = entry;
searcher.Filter = "(&(objectCategory=person)(objectClass=user))";
SearchResultCollection results = searcher.FindAll();
Run Code Online (Sandbox Code Playgroud)
我已经将我想要执行的实际查询简化为您在代码中找到的查询.但即使使用这种通用查询(它应该返回每个AD的工作?),它也会返回错误.
我在使用C#调用Web服务请求时遇到问题.
服务和请求在Soap UI中正常工作,启用了"Authenticate Preemptively"选项(文件,首选项,HTTP设置).如果未启用此设置,则服务将返回"Java.Lang.NullPointerException".
我遇到的问题是我不知道如何在C#上下文中启用此设置.
我有一个.NET 3.5类库,它包含对特定服务的所谓服务引用.这是一个简单的代码片段;
try
{
CatalogService.CatalogChangeClient service = new CatalogService.CatalogChangeClient();
service.ClientCredentials.UserName.UserName = "fancydress";
service.ClientCredentials.UserName.Password = "47fda9cb4b51a9e";
service.ClientCredentials.SupportInteractive = true;
ProductUpdate[] products = new ProductUpdate[1];
products[0] = new ProductUpdate();
products[0].ProductCode = "00001";
products[0].ProductDescription = "TestProduct";
string result = service.UpdateProducts(products);
}
catch (Exception exception)
{
Console.WriteLine(exception.Message);
}
Run Code Online (Sandbox Code Playgroud)
第一次回复后更新.
CatalogService.CatalogChangeClient类似乎实现了WCF抽象类
System.ServiceModel.ClientBase<TChannel>
Run Code Online (Sandbox Code Playgroud)
结束更新
谁能帮我设置这个属性?