好吧我的问题是我已经创建了一个Web应用程序,它访问AD以检查您是否属于某个特定组。它在visual studio(使用IIS Express服务器)中工作正常,但是当我将它部署到真正的IIS服务器时,我得到了这个错误(当调用CredentialsController.Get()时):
"Message":"An error has occurred.","ExceptionMessage":"Unknown error (0x80005000)","ExceptionType":"System.Runtime.InteropServices.COMException","StackTrace":"
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)\r\n
at System.DirectoryServices.DirectoryEntry.Bind()\r\n
at System.DirectoryServices.DirectoryEntry.get_AdsObject()\r\n
at System.DirectoryServices.PropertyValueCollection.PopulateList()\r\n
at System.DirectoryServices.PropertyValueCollection..ctor(DirectoryEntry entry, String propertyName)\r\n
at System.DirectoryServices.PropertyCollection.get_Item(String propertyName)\r\n
at System.DirectoryServices.AccountManagement.PrincipalContext.DoLDAPDirectoryInitNoContainer()\r\n at System.DirectoryServices.AccountManagement.PrincipalContext.DoDomainInit()\r\n
at System.DirectoryServices.AccountManagement.PrincipalContext.Initialize()\r\n
at System.DirectoryServices.AccountManagement.PrincipalContext.get_QueryCtx()\r\n
at System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithTypeHelper(PrincipalContext context, Type principalType, Nullable`1 identityType, String identityValue, DateTime refDate)\r\n at System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithType(PrincipalContext context, Type principalType, String identityValue)\r\n
at System.DirectoryServices.AccountManagement.GroupPrincipal.FindByIdentity(PrincipalContext context, String identityValue)\r\n
at Forsikringsapp.Core.Services.ADLookupService.IsInGroup(PrincipalContext ctx, String user, String group)\r\n
at Forsikringsapp.Web.Controllers.CredentialsController.Get()\r\n
所以我猜我需要在IIS服务器上配置一些东西,但是无法找到答案。