Link to home
Start Free TrialLog in
Avatar of Stacie
StacieFlag for United States of America

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
 

Open in new window

Avatar of Rajkumar Gs
Rajkumar Gs
Flag of India image

Avatar of Ravi Vaddadi
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/password)

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.
Avatar of Stacie

ASKER

Here is my connection string:

<connectionStrings>
            <add name="AdvancePayrollConnectionString" connectionString="Data Source=SVSQ02\MACOMB_TEST;Initial Catalog=AdvancePayroll;Integrated 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....
Try this
<add name="AdvancePayrollConnectionString" connectionString="Data Source=SVSQ02\MACOMB_TEST;Initial Catalog=AdvancePayroll;Integrated Security=true"/>
Avatar of Stacie

ASKER

No Luck :(
ASKER CERTIFIED SOLUTION
Avatar of brwwiggins
brwwiggins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Stacie

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?
Avatar of Stacie

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.