Click here to Skip to main content
15,884,176 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hello Team, need your expertise to resolve the problem.

i have a web application deployed usinf IIS 7.0 in my DEv enviroment. but when i try to browse i am getting below error.

Exception Details: System.Data.SqlClient.SqlException: Login failed for user '####'.


please find the
Framework Version:2.0.50727.5485; ASP.NET Version:2.0.50727.5491 and

Stack Trace:


[SqlException (0x80131904): Login failed for user '#####'.]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +6256793
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +245
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1099
System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +53
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +248
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +6271658
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +6271624
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +354
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +703
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +54
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +6272888
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +81
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +1657
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +88
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +6276327
System.Data.SqlClient.SqlConnection.Open() +258
System.Data.Linq.SqlClient.SqlConnectionManager.UseConnection(IConnectionUser user) +65
System.Data.Linq.SqlClient.SqlProvider.get_IsSqlCe() +33
System.Data.Linq.SqlClient.SqlProvider.InitializeProviderMode() +32
System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) +63
System.Data.Linq.DataQuery`1.System.Collections.Generic.IEnumerable<t>.GetEnumerator() +45
System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +471
System.Linq.Enumerable.ToList(IEnumerable`1 source) +78

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +1255
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +38
System.Web.UI.WebControls.LinqDataSourceView.ToList(IQueryable query, Type dataObjectType) +168
System.Web.UI.WebControls.LinqDataSourceView.ExecuteSelectQuery(LinqDataSourceSelectEventArgs selectEventArgs, Object selectResult, Object table, Boolean storeOriginalValues) +741445
System.Web.UI.WebControls.LinqDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +509
System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +71
System.Web.UI.WebControls.ListControl.PerformSelect() +49
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.ListControl.OnPreRender(EventArgs e) +31
System.Web.UI.Control.PreRenderRecursiveInternal() +108
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3394

Note: same application is working properly fine in Production. any clue what i have to check to resolve the issue.

regards,
AB
Posted
Updated 24-May-15 23:54pm
v2

It looks like you AppPool User does not have rights to login on your database.

Make sure that the AppPool User being used by your website have sufficient rights to connect and execute commands on your database.
 
Share this answer
 
Comments
ajitdstar4u 25-May-15 6:12am    
how to check that and add that rights to my website ? same application is working fine in production environment. ant clue?
Abhipal Singh 25-May-15 6:54am    
Well, I think that is what I wrote in my solution.

Check the App Pool being used by you website, then check the Username on which that app pool is running.

Once you get the user name, check if that user name have rights on your SQL server database to login and execute commands.

Also, on production I am pretty sure your Website App Pool user have rights on your production database.
ajitdstar4u 25-May-15 10:25am    
i am working with my DBA for the same issue,
1. previously my PROD is working fine, but we changed the password of Prod DB and now i am getting the same issue for my Prod also.


Login failed for user '####'.
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 'HW_Logging'.
Abhipal Singh 25-May-15 11:19am    
The error is quite clear. The user "HW_Logging" does not have login rights on your SQL server. If you have changed the password, then update the new password everywhere else.
ajitdstar4u 26-May-15 7:43am    
thanks Abhipal for your response, but the DBA told me i have the all the required access . when i tried to connect from sql server i am able to connect using the same user id and password.
but when i am trying to browse from IIS i am getting the error. please help my production is not working.
Guys at last i got the solution for this problem, it was lies with the user ID and password what my application is using to connect the DB(to access the). the user say user AB had some of privileged for access to Sql DB. for some reason it was lost so in IIS when i am trying to browse the Web application it is throwing error.

solution:

i worked with DBA check the same app running in different environment and gave the same privilege to the user.

it worked for me.

just reset the IIS using iisreset command and it will work have fun guys.

thanks abhipal for your input.

:)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900