Sql-server – SQL Server and windows authentication in IIS7


I'm trying to get an ASP.NET website running on Vista (IIS7), using SQL Server and Windows Authentication. No matter what I do, when I connect to the database, I get the exception:

    SqlException was unhandled
    Login failed for user 'MyDomain\MachineName$'.

It doesn't seem to matter what settings I apply, I cannot get IIS7 to pass through my Windows login credentials.

Extra details:

  • Both the SQL Server and my local machine are on ActiveDirectory
  • Vista Enterprise, IIS7
  • SQL Server 2005
  • Anonymous Authentication disabled, Windows Authentication enabled
  • Impersonation on/off makes no difference
  • All Identities (NetworkService, LocalSystem, etc) give the same result
  • Classic and integrated pipelines give the same result


Best Solution

Impersonation on/off makes all the difference, when properly configured. What you want is caled 'constrained delegation' and you need to configure IIS and ASP for it: