Компилятор и IIS не доверяют отношениям между доменом и рабочей станцией

#c# #asp.net #iis

#c# #asp.net #iis

Вопрос:

Я пытаюсь запустить веб-приложение, которое отлично работало на моем компьютере с XP, но теперь оно на Windows 7.

Когда я запускаю компилятор, я получаю:

 Server Error in '/' Application.

The trust relationship between this workstation and the primary domain failed.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.SystemException: The trust relationship between this workstation and the primary domain failed.


Source Error: 


Line 34:                     string username = HttpContext.Current.User.Identity.Name.ToString();
Line 35: 
Line 36:                     bool yesno = HttpContext.Current.User.IsInRole("Group0Users");
Line 37: 
Line 38:                     string role = GetRole.OfUser(username);

Source File: C:UsersagordonDocumentsVisual Studio 2008ProjectslomdbEnterDataGlobal.asax.cs    Line: 36 

Stack Trace: 


[SystemException: The trust relationship between this workstation and the primary domain failed.
]
   System.Security.Principal.NTAccount.TranslateToSids(IdentityReferenceCollection sourceAccounts, Booleanamp; someFailed)  1185
   System.Security.Principal.NTAccount.Translate(IdentityReferenceCollection sourceAccounts, Type targetType, Booleanamp; someFailed)  44
   System.Security.Principal.NTAccount.Translate(IdentityReferenceCollection sourceAccounts, Type targetType, Boolean forceSuccess)  47
   System.Security.Principal.WindowsPrincipal.IsInRole(String role)  101
   EnterData.Global.Application_AuthenticateRequest(Object sender, EventArgs e) in C:UsersagordonDocumentsVisual Studio 2008ProjectslomdbEnterDataGlobal.asax.cs:36
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  68
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Booleanamp; completedSynchronously)  75

Version Information: Microsoft .NET Framework Version:2.0.50727.5448; ASP.NET Version:2.0.50727.5420
 

И когда я публикую его в IIS и запускаю его оттуда, я получаю эту ошибку:

 Server Error in '/' Application.

The trust relationship between this workstation and the primary domain failed.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.SystemException: The trust relationship between this workstation and the primary domain failed.


Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[SystemException: The trust relationship between this workstation and the primary domain failed.
]
   System.Security.Principal.NTAccount.TranslateToSids(IdentityReferenceCollection sourceAccounts, Booleanamp; someFailed)  1085
   System.Security.Principal.NTAccount.Translate(IdentityReferenceCollection sourceAccounts, Type targetType, Boolean forceSuccess)  46
   System.Security.Principal.WindowsPrincipal.IsInRole(String role)  128
   EnterData.Global.Application_AuthenticateRequest(Object sender, EventArgs e) in C:UsersagordonDocumentsVisual Studio 2008ProjectslomdbEnterDataGlobal.asax.cs:38
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  80
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Booleanamp; completedSynchronously)  171

Version Information: Microsoft .NET Framework Version:2.0.50727.5448; ASP.NET Version:2.0.50727.5420
 

Что я делаю не так? Как я могу исправить эту проблему?

Комментарии:

1. вы пытаетесь получить доступ к информации о безопасности (ActiveDirectory / Domain или аналогичной)… для этого вам необходимо пройти аутентификацию с помощью учетной записи, имеющей соответствующие разрешения для выполнения этих действий… ошибка просто говорит о том, что ни ваш компьютер, ни ваш пользователь не имеют этих разрешений… Кстати: по какой причине вы не используете try / catch в своем коде?

2. По какой-то причине я не могу, но вы также должны пометить это «windows-7». Я думаю, что обновление ОС является ключом к разгадке.

Ответ №1:

Попробуйте сбросить пароль компьютера с помощью:

 NETDOM RESETPWD /Server:DC.Domain.tld /UserD:Administrator /PasswordD:xxx
 

В противном случае покиньте домен и присоединитесь к нему с помощью графического интерфейса .