Stacie
asked on
Login failed for user ''. The user is not associated with a trusted SQL Server connection.
I have developed a asp page. Once I try to test my application I get this page. I'm connected to a test database. I was wondering if someone can help me resolve this?
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SqlException (0x80131904): Login failed for user ''. The user is not associated with a trusted SQL Server connection.]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4846887
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +35
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +144
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +342
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +221
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +189
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +185
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +31
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +433
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +499
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +65
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
System.Data.SqlClient.SqlConnection.Open() +122
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) +31
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +112
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +287
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +92
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1297
System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +95
System.Web.UI.WebControls.ListControl.PerformSelect() +34
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +22
System.Web.UI.WebControls.ListControl.OnPreRender(EventArgs e) +18
System.Web.UI.Control.PreRenderRecursiveInternal() +80
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint
Looks like something wrong with your connection string. could you post your connection string?
The error is due to either the SQL authentication is not enable change the MSSQL authentication metioned to mix mode or your Credentail is wrong is connection string(hostname/user/passw ord)
Enable Mix mode authentication
1. Login MSSQl Server using SQL Server Management Studio
2. Right-click the server that you want to change to SQL Server and Windows authentication, and then click Properties.
3. In the SQL Server Properties dialog box, click the Security tab, click SQL Server and Windows (or mix mode), and then click OK.
4. When you are prompted to re-start the SQL Server service, click Yes.
Enable Mix mode authentication
1. Login MSSQl Server using SQL Server Management Studio
2. Right-click the server that you want to change to SQL Server and Windows authentication, and then click Properties.
3. In the SQL Server Properties dialog box, click the Security tab, click SQL Server and Windows (or mix mode), and then click OK.
4. When you are prompted to re-start the SQL Server service, click Yes.
ASKER
Here is my connection string:
<connectionStrings>
<add name="AdvancePayrollConnec tionString " connectionString="Data Source=SVSQ02\MACOMB_TEST; Initial Catalog=AdvancePayroll;Int egrated Security=True" providerName="System.Data. SqlClient" />
</connectionStrings>
I already have a "Enable Mix Mode Authentication" Set on my sql server, maybe I'm missing something....
<connectionStrings>
<add name="AdvancePayrollConnec
</connectionStrings>
I already have a "Enable Mix Mode Authentication" Set on my sql server, maybe I'm missing something....
Try this
<add name="AdvancePayrollConnec tionString " connectionString="Data Source=SVSQ02\MACOMB_TEST; Initial Catalog=AdvancePayroll;Int egrated Security=true"/>
<add name="AdvancePayrollConnec
ASKER
No Luck :(
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I use the sql user account on my sql database and I have granted all the permission to it from it.... What do you mean by application pool?
ASKER
Is this something I should look into?
This error message can appear consistently for local connections using trusted authentication, when SQL Server’s SPN is not interpreted by SSPI as belonging to the local machine. This can be caused either by a misconfiguration of DNS, or by a machine having multiple names. If your machine has multiple names, try to work around the need for multiple names and give it a unique name. If the machine just has one name, then check your DNS configuration.
This error message can appear consistently for local connections using trusted authentication, when SQL Server’s SPN is not interpreted by SSPI as belonging to the local machine. This can be caused either by a misconfiguration of DNS, or by a machine having multiple names. If your machine has multiple names, try to work around the need for multiple names and give it a unique name. If the machine just has one name, then check your DNS configuration.
https://www.experts-exchange.com/questions/24579502/Login-failed-for-user-''-The-user-is-not-associated-with-a-trusted-SQL-Server-connection.html?sfQueryTermInfo=1+10+30+associ+connect+fail+login+server+sql+trust+user&anchorAnswerId=24882898#a24882898
Raj