У нас есть обработчик ashx http, который извлекает переменную REMOTE_USER из ServerVariables во время ProcessRequest.
public void ProcessRequest(HttpContext context)
{
if (context.Request.ServerVariables["REMOTE_USER"].Contains("\\")) // exception is thrown here
...
Аутентификация обрабатывается IIS с использованием базовой аутентификации (учетные записи Windows на контроллере домена).
Для некоторых пользователей это начинает давать сбой (после исправной работы в течение нескольких часов) и выдает следующее исключение:
[IdentityNotMappedException: Some or all identity references could not be translated.]
System.Security.Principal.SecurityIdentifier.Translate(IdentityReferenceCollection sourceSids, Type targetType, Boolean forceSuccess) +7608560
System.Security.Principal.SecurityIdentifier.Translate(Type targetType) +100
System.Security.Principal.WindowsIdentity.GetName() +164
System.Security.Principal.WindowsIdentity.get_Name() +31
System.Web.HttpRequest.CalcDynamicServerVariable(DynamicServerVariable var) +8726378
System.Web.HttpServerVarsCollection.GetSimpleServerVar(String name) +424
System.Web.HttpServerVarsCollection.Get(String name) +8634072
System.Collections.Specialized.NameValueCollection.get_Item(String name) +7
Some.Namespace.AHttpHandler.ProcessRequest(HttpContext context) in c:\afolder\AHttpHandler.ashx.cs:34
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
После перезапуска пула приложений этого приложения проблема решается в течение дня.
Есть идеи?Должны ли мы использовать другую переменную сервера для получения имени пользователя?
Спасибо!