On my ASP.NET web.config I have the connection string:
initial catalog=DatabaseName; data source=(local); Integrated Security=SSPI;MultipleActiveResultSets=True; Connect Timeout=200;
I've used this connection string for Windows Authentication before, but now I'm getting the error:
Login failed for user ''.
This seems like its a SQL Authentication error, and that the username is blank as I have not supplied either a username or password.
Why is the application attempting SQL Authentication and not Windows?
How can I resolve this issue?
For your connection string to work from ASP.NET application, your request must be running under user identity that can access SQL Server. By default, it will use identity of app pool worker process and generally, this identity is a local user (on the server) that does not have access to SQL Server. So you may try changing this identity to see if that help.
If you want to use identity of the windows user that is accessing your ASP.NET site then you have turn integrated authentication on in both IIS and ASP.NET. You also need to turn on the ASP.NET impersonation so that ASP.NET request will execute on the user's identity.
If you are still facing the issue then you might be facing double hop issue related to windows authentication (see two links sighted in the article for more info and trouble shooting).