Friday, March 30, 2012

Login failed for user NT AUTHORITY\ANONYMOUS LOGON.

get the following error when a user tries to logon from work station.
The website is hosted on IIS on the same server as sql server 2005
website is asp.net 2.0

SqlException (0x80131904): Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +734883
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188
System.Data.SqlClient.TdsParser.Run(RunBehaviorrunBehavior, SqlCommand cmdHandler, SqlDataReader dataStream,BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)+1838
System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +33
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +628
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentityidentity, SqlConnectionString connectionOptions, Object providerInfo,String newPassword, SqlConnection owningObject, BooleanredirectedUserInstance) +170
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +359
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +496
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
System.Data.SqlClient.SqlConnection.Open() +111
System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate) +84
System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +197
System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(Stringusername, Boolean updateLastLoginActivityDate, Int32& status,String& password, Int32& passwordFormat, String&passwordSalt, Int32& failedPasswordAttemptCount, Int32&failedPasswordAnswerAttemptCount, Boolean& isApproved,DateTime& lastLoginDate, DateTime& lastActivityDate) +1121
System.Web.Security.SqlMembershipProvider.CheckPassword(Stringusername, String password, Boolean updateLastLoginActivityDate, BooleanfailIfNotApproved, String& salt, Int32& passwordFormat) +105
System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved) +42
System.Web.Security.SqlMembershipProvider.ValidateUser(String username, String password) +83
System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +160
System.Web.UI.WebControls.Login.AttemptLogin() +105
System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +99
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102

Hi,

i think you have allowed ANONYMOUS Access to your website in the IIS Admin. The ASP.NET worker process using the ANONYMOUS user account and the process-user will connect to your SQL Database. Is that realy what you want? I think you have a special sql user account, or? So you must impersonate your asp.net worker process. See this MSDN Article for more information about impersonation:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsent7/html/vxconImpersonation.asp

Regards
Marc André

|||

thanks for the reply, I want to be able to use the NetworkService account.

"In Internet Information Services (IIS) 6, the default identity is the NetworkService account."

How do I go about setting this up so the website and sql server 2005 allow the NetworkService user?

|||

ghw123:

thanks for the reply, I want to be able to use the NetworkService account.

"In Internet Information Services (IIS) 6, the default identity is the NetworkService account."

How do I go about setting this up so the website and sql server 2005 allow the NetworkService user?

Try the link below for how to use T-SQL to grant the Networkservice account permissions in SQL Server to run Asp.net. Hope this helps.

http://www.thedatafarm.com/blog/PermaLink.aspx?guid=2bd8f8c8-1b16-46ee-91f6-d8d3080e562b

|||

Thanks for the reply I tried the

sp_grantlogin 'NT AUTHORITY\NETWORK SERVICE' on the master database

but no luck still get the same error msg.

|||

ghw123:

Thanks for the reply I tried the

sp_grantlogin 'NT AUTHORITY\NETWORK SERVICE' on the master database

but no luck still get the same error msg.

The first thing to do is verify in the Master database that the account was created and if yes then your only option is to use basic autthentication which could leave your application passwords in plain text. Hope this helps.

|||

Add the aspnet account to the SQL server 2005

Please have a look at thishttp://ambarishganguly.blogspot.com/2007/01/aspnet-account-and-sql-server.html. .

To add a user in SQL Server 2005, you can follow the following steps as outlined in

http://ambarishganguly.blogspot.com/2006/12/sql-server-2005-adding-user.html

In this way, you can easily use the website along with SQL Server 2005

Thanks

Ambarish.

|||

thanks for the replies,

this site was originally on a different server. I moved both the site and the database to the new server.

The problem was in one of the connection strings used on the site.
I had changed all but one of the strings to reflect the change of server name.
Once this string was changed as well then everything worked ok.

No comments:

Post a Comment