IIS -Imitation funktioniert nicht, wenn der App -Pool mit Domain -Konto ausgeführt wird
Posted: 22 May 2025, 22:07
Ich habe eine ASP.NET -Anwendung in einer Windows -Intranet -Umgebung. Ich habe die Anforderung, bestimmte Datenbankaktualisierungen als als derzeit angemeldete in Benutzer durchzuführen. < /p>
IIS /Server Info: < /p>
Wenn ich die App -Pool -Identität ändere, um AppPoolIdentity (die Standard -App -Pool -Identität) zu verwenden, funktioniert die Impotation richtig.>
IIS /Server Info: < /p>
- IIS Version 10 < /> Windows Server 2019 < /li>
asp.net -Web -Forms -Anwendung < /li>
.NET 4.7 < /li> < /li>
< Authentifizierung aktiviert - Imitation und Anonyme Authentifizierung sind deaktiviert.
- All of my database connection strings are set such that integrated security=true
- in active directory, have configured constrained delegation between the web server and the SQL server, allowing MSSQLSvc : 1433 and MSSQLSvc (no port)
- The domain service account is a member of the local administrators group on the web server (for testing purposes only)
Code: Select all
var windowsIdentity = User.Identity as WindowsIdentity;
WindowsIdentity.RunImpersonated(windowsIdentity.AccessToken, () =>
{
// perform database update
});
< /code>
Dies bringt eine Ausnahme aus -
System.Data.SqlClient.SqlException: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'
Wenn ich die App -Pool -Identität ändere, um AppPoolIdentity (die Standard -App -Pool -Identität) zu verwenden, funktioniert die Impotation richtig.>