login failed for user <domainname/machinename$>

Proposed Answer login failed for user <domainname/machinename$>

  • Thursday, February 28, 2013 12:07 AM
     
      Has Code

    I'm using SQL 2012 with Visual Studio 2012. I set up a simple Webform (.aspx) page with a details view and grid view). When I try to access the .aspx page I get an error saying the  login faile for user <domain name\machine name$>.

    I've added the machine name to the the database Security login list with dbowner permissions.

    I've added the Network Service to the Security login list with dbowner permissions.

    I've added the NT Authority Service to the Security login list with dbowner permissions.

    I've also tried all other permissions, and can't seem to get the database to allow access.

    The SQL Server and the Website are on the same server.

    Any other suggestions? Thanks!

    Here is the code of the webconfig file:

    <configuration>
        <connectionStrings>
            <add name="CMSConnectionString" connectionString="Data Source=SID\SIDNEY;Initial Catalog=CMS;Integrated Security=True"
                providerName="System.Data.SqlClient" />
        </connectionStrings>
        <system.web>
          <compilation debug="true" strict="false" explicit="true" targetFramework="4.5" />
          <httpRuntime targetFramework="4.5"  />
          <customErrors mode="Off"/>
    
        </system.web>
    
    </configuration>
    


    Jill Trehearne

All Replies

  • Thursday, February 28, 2013 8:19 AM
    Moderator
     
     Proposed Answer

    Hi Jill,

    Could you post the complete error messages?

    For troubleshooting the "login failed for user", we can refer to this article:

    http://msdn.microsoft.com/en-us/library/ms366351(v=sql.105).aspx

    If you can provide the state number, it will be easier to detect the problem.

    Please also refer to this thread, the solutions in this thread may help:

    http://social.msdn.microsoft.com/Forums/en-US/sqlgetstarted/thread/40d83498-f52f-41e9-8d11-f2ea43413479/

    TechNet Subscriber Support

    If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.


    Iric Wen
    TechNet Community Support


  • Friday, March 01, 2013 4:24 PM
     
      Has Code

    Thanks for the reply... sorry for the delay in getting back to you. Here is the error message in IE 9... "SID" is the name of the Windows 2008 R2 Server...

    Server Error in '/CMSEntry' Application.
    --------------------------------------------------------------------------------
    
    Login failed for user 'EQTY2\SID$'. 
    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 'EQTY2\SID$'.
    
    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 'EQTY2\SID$'.]
       System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +6676046
       System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +810
       System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4403
       System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +84
       System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +55
       System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) +368
       System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) +6704814
       System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) +6705315
       System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions) +610
       System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +1049
       System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +74
       System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnectionOptions userOptions) +6707883
       System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnectionOptions userOptions) +78
       System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +2192
       System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +116
       System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +1012
       System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +6712511
       System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +152
       System.Data.SqlClient.SqlConnection.Open() +229
       System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +292
       System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +420
       System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +280
       System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +3587315
       System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +28
       System.Web.UI.WebControls.DataBoundControl.PerformSelect() +313
       System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +146
       System.Web.UI.WebControls.FormView.EnsureDataBound() +99
       System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +192
       System.Web.UI.Control.EnsureChildControls() +189
       System.Web.UI.Control.PreRenderRecursiveInternal() +60
       System.Web.UI.Control.PreRenderRecursiveInternal() +222
       System.Web.UI.Control.PreRenderRecursiveInternal() +222
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4297
     
    
    
    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18034 


    Jill Trehearne

  • Thursday, March 07, 2013 9:07 AM
    Moderator
     
     

    Hi Jill,

    This issue always caused by remote connections turned off in SQL Server.

    Please follow this kb article to configure your SQL Server:

    http://support.microsoft.com/kb/914277

    And also McAfee may be the cause of the failure, refer to this reference:

    https://kc.mcafee.com/corporate/index?page=content&id=KB59781


    Iric Wen
    TechNet Community Support

  • Thursday, March 07, 2013 7:07 PM
     
     

    Thank you for the reply. Unfortunately, the steps in the article didn't seem to help.

    - We don't use McAfee - so no conflicts there.

    - The Allow Remote Desktop option is selected.

    - The SQL Server Browser service is started.

    - The Surface Configuration mgr. changes were made.

    Still no luck... this is definitely a permissions issue with SQL 2012, but can't seem to get it narrowed down..

    any other suggestions?

    Thanks!


    Jill Trehearne

  • Sunday, March 17, 2013 11:50 AM
    Moderator
     
     

    Hello,

    You wrote : Login failed for user 'EQTY2\SID$'

    Are you sure that the user is SID$ ? ( the $ symbol seems surprising )

    Moreover, you are using Windows authentification , the Windows user name you have used to log on your computer must be recognized ( exist with authorized connection ) for the SQL Server instance . This Windows user name must have at least the Connect permission  and db_datareader and ( maybe ) db_datawriter authorizations for the database.

    Please, could you tell us whether you are trying to connect to your SQL Server with a local connection ( same computer for the SQL Server and for your application ) or with a remote connection ( your application is executing on a computer different from the computer where SQL Server is installed )

    Have a nice day.


    Mark Post as helpful if it provides any help.Otherwise,leave it as it is.