我使用以下代码创建应用程序池:varmetabasePath=string.Format(@"IIS://{0}/W3SVC/AppPools",serverName);DirectoryEntrynewpool;DirectoryEntryapppools=newDirectoryEntry(metabasePath);newpool=apppools.Children.Add(appPoolName,"IIsApplicationPool");newpool.CommitChanges();如何指定应用程序池应使用.NETFramework4.0? 最佳
我看到使用PrincipalSearcher的ActiveDirectory示例和其他使用DirectorySearcher做同样事情的示例。这两个例子有什么区别?使用PrincipalSearcher的示例PrincipalContextcontext=newPrincipalContext(ContextType.Domain);PrincipalSearchersearch=newPrincipalSearcher(newUserPrincipal(context));foreach(UserPrincipaluserinsearch.FindAll()){if(null!=us
我看到使用PrincipalSearcher的ActiveDirectory示例和其他使用DirectorySearcher做同样事情的示例。这两个例子有什么区别?使用PrincipalSearcher的示例PrincipalContextcontext=newPrincipalContext(ContextType.Domain);PrincipalSearchersearch=newPrincipalSearcher(newUserPrincipal(context));foreach(UserPrincipaluserinsearch.FindAll()){if(null!=us
当我尝试使用GroupPrincipal.FindByIdentity方法查询ActiveDirectory时,出现间歇性COM异常“发生操作错误(0x80072020)”(如下所示)这是我的代码:PrincipalContextctx=newPrincipalContext(ContextType.Domain,Environment.UserDomainName);GroupPrincipalgroupPrincipal=GroupPrincipal.FindByIdentity(ctx,IdentityType.Name,"Grouptofind");我收到异常:InnerExc
当我尝试使用GroupPrincipal.FindByIdentity方法查询ActiveDirectory时,出现间歇性COM异常“发生操作错误(0x80072020)”(如下所示)这是我的代码:PrincipalContextctx=newPrincipalContext(ContextType.Domain,Environment.UserDomainName);GroupPrincipalgroupPrincipal=GroupPrincipal.FindByIdentity(ctx,IdentityType.Name,"Grouptofind");我收到异常:InnerExc
我正在尝试在网站项目中使用System.DirectoryServices,但出现此错误:Thetypeornamespacename'DirectoryServices'doesnotexistinthenamespace'System'(areyoumissinganassemblyreference?)我的项目在web.config中引用了System.DirectoryServices:而且我确实在我想使用它的文件中使用System.DirectoryServices。有人知道在哪里寻找问题吗? 最佳答案 右键单击您的解决方
我正在尝试在网站项目中使用System.DirectoryServices,但出现此错误:Thetypeornamespacename'DirectoryServices'doesnotexistinthenamespace'System'(areyoumissinganassemblyreference?)我的项目在web.config中引用了System.DirectoryServices:而且我确实在我想使用它的文件中使用System.DirectoryServices。有人知道在哪里寻找问题吗? 最佳答案 右键单击您的解决方
在过去的几年里,我一直在使用这个小功能来验证用户凭据,没有任何问题。createPrincipalContext方法返回一个带有ContextType.Machine和机器名称的PrincipalContext。publicstaticboolValidateCredentials(stringusername,stringpassword,stringdomain=null){try{using(varprincipalContext=createPrincipalContext(username,domain)){username=GetLoginInfo(username).Us
在过去的几年里,我一直在使用这个小功能来验证用户凭据,没有任何问题。createPrincipalContext方法返回一个带有ContextType.Machine和机器名称的PrincipalContext。publicstaticboolValidateCredentials(stringusername,stringpassword,stringdomain=null){try{using(varprincipalContext=createPrincipalContext(username,domain)){username=GetLoginInfo(username).Us
我在域中使用方法UserPrincipal.Current.ToString()来获取当前登录域用户的有效域。但是当我在一个字符串中显示它时,它在IIS服务器中托管时出现错误:Unabletocastobjectoftype'System.DirectoryServices.AccountManagement.GroupPrincipal'totype'System.DirectoryServices.AccountManagement.UserPrincipal'. 最佳答案 我遇到了同样的问题。它在我的本地机器上运行良好,但是当