Итак, у меня есть хостинг домен, на котором в данный момент запущено мое приложение на IIS 7, Настройки пула приложений:
- Удостоверение личности: Сетевая служба
- Управляемый конвейерный режим: интегрированный
- .NET версия: v4.0
- Имя: .NET v4.5
Настройки аутентификации IIS:
- Аноним: Отключено
- Олицетворение: включено
- Формы: отключено
- Windows: включено
Существует также другая версия приложения, которая отлично работает с этими настройками. Таким образом, в моем текущем приложении у меня есть этот код для получения и хранения SID пользователя:
public static SecurityIdentifier GenerateUserSID()
{
return (UserPrincipal.Current.Sid);
}
public virtual ActionResult AddComment (string comment, int taskId, DateTime selectedDate)
{
var msg = string.Empty;
try
{
Comment newComment = new Comment();
var sid = ApplicationUtils.GenerateUserSID();
newComment.CommentText = comment;
newComment.Analyst = sid.ToString();
newComment.TaskHistoryId = taskId;
newComment.SelectedDateTimestamp = selectedDate;
newComment.AddedTimestamp = DateTime.Now;
_db.Comments.Add(newComment);
_db.SaveChanges();
}
catch (Exception e)
{
msg = "Error: " + e;
return Json(msg, JsonRequestBehavior.AllowGet);
}
return Json(comment, JsonRequestBehavior.AllowGet);
}
И я получаю следующую ошибку:
System.DirectoryServices.DirectoryServicesCOMException (0x80072020): Произошла ошибка операций. в System.DirectoryServices.DirectoryEntry.Bind (Boolean throwIfFail) в System.DirectoryServices.DirectoryEntry.Bind () в System.DirectoryServices.DirectoryEntry.get_AdsObject () в System.DirectoryServices.PropertyValueCollection.PopulateListProolServiceSirect. ctor (запись DirectoryEntry, свойство String propertyName) в System.DirectoryServices.PropertyCollection.get_Item (String propertyName) в System.DirectoryServices.AccountManagement.PrincipalContext.DoLDAPDirectoryInitNoContainer () в System.Directory.ervice.agement.AccessInervices.Convices.AppountIntevices.Convices.PortoryConvice.Convice.Convice.Connect.AccessDirectoryServices.AccountMan.dll .PrincipalContext.Initialize () в System.DirectoryServices.AccountManagement.PrincipalContext.get_QueryCtx () в System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithTypeHelper (контекст типа PrincipalContement, DateTyntalDateIllTylyTyleTyTellTyleTyTeleTyTeNTeTeLETTeNeTeLETTyTeNeTeLETTyTeNTTeLETTALTYLETYLETYTLETALTYTLETYTALTYTLETALTYTALTYTALTYTALTYTALTYTALTYTALTYTALTT )Под. .AccountManagement.Princip al.FindByIdentityWithType (контекст PrincipalContext, тип PrincipalType, IdentityType identityType, String identityValue) в System.DirectoryServices.AccountManagement.UserPrincipal.FindByIdentity (контекст PrincipalContext, IdentityType GovernmentTynt_Tervice_DirectoryTerInt_DirectorySigner). .Controllers.DashboardController.AddComment (строковый комментарий, Int32 taskId, DateTime selectedDate)
Это происходит только при доступе к приложению на удаленных компьютерах, на локальном компьютере оно работает нормально.
Кто-нибудь знает, что вызывает это и как это исправить?