I have a small ASP.NET test script that opens a connection to a SQL Server database on another machine in the domain. It isn't working in all cases.
IIS 7.5 under W2K8R2 trying to connect to a remote SQL Server 2008 R2 instance. All machines are in the same domain.
Using the ApplicationPoolIdentity for the web site it fails to connect to the SQL Server with the following:
Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. 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.Data.SqlClient.SqlException: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.
However if I switch the Process Model Identity to NETWORK SERVICE or my domain account the database connection is successful.
I've granted the \$ access in SQL Server.
I am not doing any sort of authentication on the web site, it is just a simple script to open a connection to a database to make sure it works.
I have Anonymous Authentication enabled and set to use the Application pool identity.
How do I make this work? Why is the ApplicationPoolIdentity trying to use ANONYMOUS LOGON? Better yet, how do I make it stop using the Anonymous logon?