Unhandled Exception Error - Login Failed for User

Hello,
I am receiving an error when I run my application stating “Unhandled exception has occurred. If you click continue, the application will ignore the error………..Login failed for MyUser.
When I click the Continue button the application runs and seems to work properly. This application used to run without receiving the error and I did not make any changes. I have another application that is using basically the exact same code and does not
receive the error. The only difference is the application is querying a different DB but using the exact same connection string. The error only occurs when I run the exe file created from the build. When I run (debug) the application from within the VS 2013
IDE I do not receive the error.
Here are the details to the error message:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.Data.OleDb.OleDbException (0x80040E4D): Login failed for user 'jobrunner'.
   at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
   at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.OleDb.OleDbConnection.Open()
   at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
   at LoanOrig_FDIC_Codes.DataSet1TableAdapters.I_LoansTableAdapter.Fill(I_LoansDataTable dataTable) in u:\Visual Studio Projects\LoanOrig_FDIC_Codes\LoanOrig_FDIC_Codes\LoanOrig_FDIC_Codes\DataSet1.Designer.cs:line 1668
   at LoanOrig_FDIC_Codes.Form1.Form1_Load_1(Object sender, EventArgs e) in u:\Visual Studio Projects\LoanOrig_FDIC_Codes\LoanOrig_FDIC_Codes\LoanOrig_FDIC_Codes\Form1.cs:line 152
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
LoanOrig_FDIC_Codes
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///U:/Visual%20Studio%20Projects/LoanOrig_FDIC_Codes/LoanOrig_FDIC_Codes/LoanOrig_FDIC_Codes/bin/Debug/LoanOrig_FDIC_Codes.exe
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34238 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34234 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
System.Data
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
System.Data.DataSetExtensions
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Data.DataSetExtensions/v4.0_4.0.0.0__b77a5c561934e089/System.Data.DataSetExtensions.dll
System.Numerics
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll
System.Transactions
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Transactions/v4.0_4.0.0.0__b77a5c561934e089/System.Transactions.dll
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
I'm not sure what the JIT debugger is but to my knowledge my other apps are not using that. The production username and password are correct in the connection string so I'm not clear why I am receiving this error especially since I'm not receiving the
error on my other application. I have also attached the code just in case it is needed. Any assistance will be greatly appreciated. Thank you.
Dave
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
using ClosedXML.Excel;
using DocumentFormat.OpenXml;
using System.IO;
namespace LoanOrig_FDIC_Codes
public partial class Form1 : Form
SqlCommand sqlCmd;
SqlDataAdapter sqlDA;
DataSet sqlDS;
DataTable sqlDT;
SqlCommand sqlCmdCnt;
public Form1()
InitializeComponent();
//BEGIN BUTTON LOAD CLICK EVENT
private void btnLoad_Click(object sender, EventArgs e)
string sqlCon = "Data Source=FS-12345; Initial Catalog=ExtractGenerator; User ID=MyUser; Password=MyPW";
//Set the 2 dateTimePickers to today's date
DateTime @endDate = End_dateTimePicker.Value.Date;
DateTime @startDate = Start_dateTimePicker.Value.Date;
//Validate the values of the 2 dateTimePickers
if (endDate < startDate)
MessageBox.Show("End Date must be greater than or equal to the Start Date OR Start Date must be less than or equal to the End Date ", "Incorrect Date Selection",MessageBoxButtons.OK,MessageBoxIcon.Error);
//Reset both dateTimePickers to todays date
Start_dateTimePicker.Value = DateTime.Today;
End_dateTimePicker.Value = DateTime.Today;
return;
//End of date validation
string sqlData = @"SELECT AcctNbr,
CurrAcctStatCD,
Org,
MJAcctTypCD,
MIAcctTypCD,
NoteOriginalBalance,
ContractDate,
FDICCATCD,
FDICCATDESC,
PropType,
PropTypeDesc
FROM I_Loans
WHERE CAST(ContractDate AS datetime) BETWEEN @startdate AND @enddate ORDER BY ContractDate";
SqlConnection connection = new SqlConnection(sqlCon);
SqlCommand sqlCmd = new SqlCommand(sqlData, connection);
sqlCmd.Parameters.AddWithValue("@startDate", startDate);
sqlCmd.Parameters.AddWithValue("@endDate", endDate);
sqlDS = new DataSet();
sqlDA = new SqlDataAdapter(sqlCmd); //SqlAdapter acts as a bridge between the DataSet and SQL Server for retrieving the data
connection.Open();
sqlDA.SelectCommand = sqlCmd; //SqlAdapter uses the SelectCommand property to get the SQL statement used to retrieve the records from the table
sqlDA.Fill(sqlDS, "I_Loans"); //SqlAdapter uses the "Fill" method so that the DataSet will match the data in the SQL table
sqlDT = sqlDS.Tables["I_Loans"];
//Code section to get record count
sqlCmdCnt = connection.CreateCommand();
sqlCmdCnt.CommandText = "SELECT COUNT(AcctNbr) AS myCnt FROM I_Loans WHERE ContractDate BETWEEN @startDate AND @endDate";
sqlCmdCnt.Parameters.AddWithValue("@startDate", startDate);
sqlCmdCnt.Parameters.AddWithValue("@endDate", endDate);
int recCnt = (int)sqlCmdCnt.ExecuteScalar();
txtRecCnt.Text = recCnt.ToString();
btnExport.Enabled = true;
//End of code section for record count
connection.Close();
dataGridView1.DataSource = sqlDS.Tables["I_Loans"];
dataGridView1.ReadOnly = true;
//Reset both dateTimePickers to todays date
Start_dateTimePicker.Value = DateTime.Today;
End_dateTimePicker.Value = DateTime.Today;
//END BUTTON LOAD CLICK EVENT
//BEGIN BUTTON EXPORT CLICK EVENT
private void btnExport_Click(object sender, EventArgs e)
SaveFileDialog saveFD = new SaveFileDialog();
{ //ClosedXML code to export datagrid result set to Excel
string dirInfo = Path.GetPathRoot(@"\\FS-03250\users\dyoung\LoanOrig_FDIC_Codes");
if (Directory.Exists(dirInfo))
var wb = new XLWorkbook();
var ws = wb.Worksheets.Add(sqlDT);
ws.Tables.First().ShowAutoFilter = false;
//SaveFileDialog saveFD = new SaveFileDialog(); //I moved this variable to the top of the btnExport code block so that the variable will be available thru the entire scope of that code block
saveFD.Title = "Save As";
saveFD.Filter = "Excel File (*.xlsx)| *.xlsx";
saveFD.FileName = "LoanOrig_FDIC_Codes_" + DateTime.Now.ToString("yyyy-MM-dd");
if (saveFD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
Stream stream = saveFD.OpenFile();
wb.SaveAs(stream);
stream.Close();
else if (saveFD.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
MessageBox.Show("Save file operation has been canceled", "Save As Canceled", MessageBoxButtons.OK, MessageBoxIcon.Stop);
return;
//End of ClosedXML code
MessageBox.Show("File has been exported to " + saveFD.FileName, "File Exported", MessageBoxButtons.OK, MessageBoxIcon.Information);
//MessageBox.Show("File has been exported to U:\\LoanOrig_FDIC_Codes", "File Exported", MessageBoxButtons.OK, MessageBoxIcon.Information);
else
MessageBox.Show("Drive " + saveFD.FileName + " " + "not found, not accessible, or you may have invalid permissions");
//MessageBox.Show("Drive " + "U:\\Visual Studio Projects\\LoanOrig_FDIC_Codes" + " " + "not found, not accessible, or you may have invalid permissions");
return;
//END THE SAVE AS PROCESS
//END BUTTON EXPORT CLICK EVENT
private void Form1_Load(object sender, EventArgs e)
//Set dates to be today's date when the form is openend
Start_dateTimePicker.Value = DateTime.Today;
End_dateTimePicker.Value = DateTime.Today;
private void Form1_Load_1(object sender, EventArgs e)
// TODO: This line of code loads data into the 'dataSet1.I_Loans' table. You can move, or remove it, as needed.
this.i_LoansTableAdapter.Fill(this.dataSet1.I_Loans);
private void iLoansBindingSource_CurrentChanged(object sender, EventArgs e)
private void btnExit_Click(object sender, EventArgs e)
this.Close();
David Young

In SQL you have a login which allows access to the server but you must also have permissions to access each database that you will use (including Master). So I would verify that your user also has the necessary permissions on the database itself and
not just the SQL instance. The error you're getting is from SQL saying that the user doesn't have permissions.  If it works for 1 DB but not the other on the same SQL instance then it is likely a missing permission on the DB itself.
I should note that you have a hard coded conn string in your code but the error is for a different user.  I'm assuming that you simply posted it there for convenience and that you changed the values to obscure the data.  If you are actually getting
the info from your config file then verify the connection string is correct. Also be sure to not use Integrated Security since it appears that you are using SQL authentication.

Similar Messages

  • Linked Server error: Login Failed for user 'NT AUTHORITY\ANONYMOUS LOGON' between sql server 2005 32 bit and sql server 2012 64 bit

    Hi All,
    Here the linked server is created between sql server 2012 64 bit and sql server 2005 32 bit. I am getting the below error  when i try to access linked server from third server. I have created linked from Instance 1 to Instance 2. When i access it from
    instance 3 i am getting the below error. SPN setting has been done between these 2 servers. Also the option 'Trust the delegate' is enabled for the both the service account. 
    'Login Failed for user 'NT AUTHORITY\ANONYMOUS LOGON' 
    Appreciate your quick response. 
    Vikas.M.S

    Hello,
    Please read the following resources:
    http://www.databasejournal.com/features/mssql/article.php/3696506/Setting-Up-Delegation-for-Linked-Servers.htm
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/ea26de43-4c6b-4991-86d7-e1578f107c92/linked-server-login-failed-for-user-nt-authorityanonymous-logon?forum=sqldataaccess
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • Like Server error Linked Server error: Login Failed for user 'NT AUTHORITY\ANONYMOUS LOGON'

     Getting error when trying to test the link server from remote ... Please help

    Hello,
    You've supplied us with little information other than what little is in the title. I'll refer you to a post I wrote about this. Please read
    through it and post back if it does not fix your issue. There are a few other resource links in the post to check out, but it's most likely related to a Kerberos/SPN issue.
    -Sean
    The views, opinions, and posts do not reflect those of my company and are solely my own. No warranty, service, or results are expressed or implied.

  • Login failed for user 'NT AUTHORITY\ANONYMOUS

    Hi All
    I have already gone thru lot of links, So appreciate if i can have some solution
    I have 3 servers A, B and C . A and B are in same domain and C is in different domain. and I am sysadmin in all 3 servers and all have trusted connection with each other
    1. All have tcp and named pipe enable
    2. All 3 servers and all services including browser are up and running
    3. When i connect any sql server from any Server using SSMS i am able to connect and  (net_transport, auth_scheme = TCP , NTLM).
    Now i create linked server at server B to Server C (C domain is different than A and B).  When i login on Server B and try to run query on C its working fine. But after remote login to server A and connect sql server at B using SSMS when
    i expand linked server to c i cant see databases and query is giving error "Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'"
    I also tried to connect to all 3 server in ssms using forced  named pipes but i am getting below error
    "provider named pipes provider error 40 - Could not open connection to sql server"
    My question :
    1. I have to use domain account to use linked server from server A to connect SQLserver B to server C, How this can be done is this related to Double hop ??
    2. Why i cant connect using forced Named pipe to any server using SSMS except local host
    Thanks Saurabh Sinha http://saurabhsinhainblogs.blogspot.in/ Please click the Mark as answer button and vote as helpful if this reply solves your problem

    Hello,
    First, it is possible to use Kerberos delegation across trusted domains.
    net_transport, auth_scheme = TCP , NTLM
    This means something isn't correctly setup as you're defaulting back to NTLM. This should read Kerberos if your SPNs were setup correctly and authenticated properly. Check the SPNs and service accounts.
    http://technet.microsoft.com/en-us/library/cc280744(v=SQL.105).aspx
    1. I have to use domain account to use linked server from server A to connect SQLserver B to server C, How this can be done is this related to Double hop ??
    To go across domains I'm not entirely sure on that part, but I can say it'd probably be easier if you did use a domain account as the service account.
    2. Why i cant connect using forced Named pipe to any server using SSMS except local host
    I'm not quite sure what you mean here. You can't connect through NP? Why the need for NP at all?
    Sean Gallardy | Blog |
    Twitter

  • "Login Failed for user" in Standard Report Creation Wizard

    I am trying to create a report using the report wizard in CR 08. When I choose new connection ==> OLE DB(ADO)==>Microsoft OLE DB Provider for SQL Server and enter the Server and user ID (no password), I get the error "Login failed for users".
    SQL State: 42000
    [DataBase Vendor Code: 18456]
    I was using CR 10 and called the 1-866 # and was told to try it wil CR 08 and Im getting the same error. I know the log on information is correct because I use the same server name and userID to login with SQL Server management studio and Visual Studio 08.
    Please let me know what I can do to link CR to my SQL Database.
    Thanks,
    John

    How is your user accessing the site? 
    Did you extend it to a different zone, and if so what authentication provider are you using for that zone or is it the same zone?
    Looks like the domain is a workstation name?  are they logging in with valid credentials for the WIN-IMH9QUCN1FU workstation, which may be different than what they usually log in as?
    ieDaddy
    Blog: http://iedaddy.com
    Twit: @iedaddy

  • Integrated Security results in Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON' after code deployment

    Sometimes, when we deploy new code to the server, we're getting the following error:
    Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'
    we're using windows authentication and in our connectionstring use integrated security.
    Only after restarting the server, the application can connect to the DB again. restarting IIS or recycling the application pool doesn't help.
    Our application pool is configured using ApplicationPoolIdentity and we would like to keep it as such.
    Any idea what we can do to prevent this error from occurring almost every time we deploy code?
    Thanks

    Hi amisol,
    Thanks for your post here.
    For your issue is related with asp.net security ,i suggest that you can post your issue to the link below:
    http://forums.asp.net/25.aspx/1?Security
    Best Regards,
    Kevin Shen.

  • Repository login failed for user

    Hello everyone,
    I have some errors to log on the local repository. please see the attach file.
    In fact, the repository looks like the common repository for the test.
    So I adds the "full control" right to several USER GROUPs in this repostiory via CMC.
    When the user log on this repo, he met the error "login failed for user, the user not active"
    We use BODS 4.1.
    Thanks for your help.
    Xin

    Hello Friend,
    In version 4.2 the ability to create access groups within the Central Repository was added.
    To create such groups need access SAP Data Services Management Console:
    http: //server/DataServices/launch/launch.do
    Enter your login credentials. Such permission shall be provided through the Central Management Console (http://server/BOE/CMC), including the user in the group of Data Services Administrator User.
    Once you have successfully logged on, click the Administrator button.
    On the left side there are some options, espanda the Central Repositories option and if you have properly created the Central Repository it will appear in the list.
    Click User and Groups note that by default comes a set created (digroup), select the User tab and click the option later add.
    Then enter the information which user, group, status and description and apply the changes.
    Made these procedures you can enable your central repository through the DS Designer and create new groups.
    Hope this helps.
    Hugs

  • Error while invoking member: ManagedInit1 - Login failed for user 'SRCAdmin

    I am trying to setup a Test Server for BOP 11.60 with MS SQL 2000 in MS Windows Server 2003. After installation, I copied user directory and database from live system to the new Test server. After installed the application andI updated Configuration Manager but when I run Planning Application Services, I have the following message:
    System.Exception: Error while invoking member: ManagedInit1 - Login failed for user 'SRCAdmin'. ---> System.Runtime.InteropServices.COMException (0x80131904): Login failed for user 'SRCAdmin'.
       --- End of inner exception stack trace ---
       at SRC.Core.Common.LateBoundHelper.InvokeMethodDirect(String methodName, BindingFlags flags, Object[] args)
       at SRC.Core.Common.LateBoundHelper.InvokeMethod(String methodName, Object[] args)
       at SRC.Core.Host.HostProcess.StartUp()
    I can use SRCAdmin user login to SQL Database without any problem but use Adminbop to start the Planning Application Services, I had this message.
    Does anyone know what is the problem?
    Regards,
    Irene

    Please, review your FBA configuration https://sharepoint2013fba.codeplex.com/

  • Exception Message: The form cannot connect to the data source. Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'

    When opening a form in SharePoint 12013 that was created from Infopath 2013, I get the following error.
    You do not have permissions to access a database that contains data required for this form to function correctly.
    An entry has been added to the Windows event log of the server.
    Log ID:5566
    When I go to the log files on the SharePoint server. I see the following error.
    Exception Message: The form cannot connect to the data source. Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'
    I am guessing this has something to do with the UDCX connection and the database.
    Can anyone help me get this fixed?

    Hi Jim,
    Please check the following kb article when it occurs 5566errro with the UDCX conection file, try the method of using the Secure Store Service to store alternate credentials for the data connection method, or the method of stating the credentials
    in the UDC file explicitly.
    Also check if it could help with setting sql server as "SQL Server and Windows Authentication mode".
    http://support.microsoft.com/kb/981684
    Thanks
    Daniel Yang
    TechNet Community Support

  • How to fix Login failed for user ''. (Microsoft SQL Server, Error: 18456)in windows 2008?

    Hi All,
    we are facing the Login fails issue .
    how to resolve the bellow error , could you please suggested the possible ways .. ASAP
    TITLE: Connect to Server
    Cannot connect to ..
    ADDITIONAL INFORMATION:
    Login failed for user '  domain\name'. (Microsoft SQL Server, Error: 18456)
    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=18456&LinkId=20476
    BUTTONS:
    OK
    Log Name:      Application
    Source:        MSSQLSERVER
    Date:          10/6/2011 1:56:28 PM
    Event ID:      18456
    Task Category: Logon
    Level:         Information
    Keywords:      Classic,Audit Failure
    User:          domain\name
    Computer:      
    Description:
    Login failed for user '  domain\name'. Reason: Token-based server access validation failed with an infrastructure error. Check for previous errors. [CLIENT: <local machine>]
    RAM

    I was hitting myself in the head with this problem for a couple of minutes.... Everything was fine on the DC and Domain itself.. I added the Domain admins Group Principal for which I am part of... I was getting this error  ... Long History... Short
     (Right Click and Run as Administrator took care of this for me..) UAC was the cause of the problem.
    Cannot connect to XX-DB-XX3.
    ===================================
    Login failed for user 'XXXXS\XXas'. (.Net SqlClient Data Provider)
    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=18456&LinkId=20476
    Server Name: XX-DB-XX3
    Error Number: 18456
    Severity: 14
    State: 1
    Line Number: 65536
    Program Location:
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
       at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
       at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
       at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
       at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
       at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
       at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
       at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
       at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
       at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
       at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
       at System.Data.SqlClient.SqlConnection.Open()
       at Microsoft.SqlServer.Management.SqlStudio.Explorer.ObjectExplorerService.ValidateConnection(UIConnectionInfo ci, IServerType server)
       at Microsoft.SqlServer.Management.UI.ConnectionDlg.Connector.ConnectionThreadUser()

  • Cannot connect to SERVER. Login failed for user 'DOMAIN\user'. (Microsoft SQL Server, Error 18456) - SQL Server 2012 on Windows Server 2008 R2

    I've seen multiple blogs and forums with similar problems and SQL 2012 or 2008. But no solutions that work for me.
    I have installed SQL Server in mixed mode (SQL and Windows authentication). I can create new Login accounts in either mode. However, I cannot get an AD security group Login account to work. I am trying to add group 'DOMAIN\Domain Admins' or 'SERVER\Administrators'
    as a Login so that any of the domain's administrator accounts can open SQL Server Management Studio and act as an 'sa' account on this server.
    I have deleted the SQL account 'DOMAIN\Domain Admins'.
    I have restarted SQL.
    I have restarted the Win2K8r2 server.
    I have launched SSMS as Administrator from the desktop of SERVER.
    I have launched SSMS as another user (and used 'DOMAIN\user' to lauch it) from the desktop of SERVER.
    I can create a login account named 'DOMAIN\user' (who happens to be a member of the 'DOMAIN\Domain Admins' group) and give this account 'sa' security, and when I do that, this account works as expected...
    How do I add a security group as a Login account and give all members of that group the ability to be an 'sa' account?

    Hi geoperkins,
    Are you getting the following error message?
    Error: 18456, Severity: 14, State: 11
    Login failed for user <Domain\user>. Reason: Token-based server access validation failed with an infrastructure error.
    If that is the case, the issue could be due to that the Windows login has no profile or that permissions could not be checked due to UAC. Please disable UAC firstly and check if it is successful to log in SQL Server.
    Another reason could be that the domain controller could not be reached. You may need to resort to re-creating the login. Create a new group in AD, add users to the new group, then add the group to the local admin group and create login for the group in SQL
    Server.
    There is a connect item describing similar issue for your reference.
    https://connect.microsoft.com/SQLServer/feedback/details/680705/cant-login-to-sql-using-windows-authentication-when-user-is-in-a-domain-security-group
    For more details about above error, please review the following blog.
    http://sqlblogcasts.com/blogs/simons/archive/2011/02/01/solution-login-failed-for-user-x-reason-token-based-server-access-validation-failed-and-error-18456.aspx
    Thanks,
    Lydia Zhang
    Lydia Zhang
    TechNet Community Support

  • SQL Server Agent job between 2 instances fails with Error 18456 - Login Failed for user

    Hi,
    SQL Server version: 2012 EE
    OS: Windows 2008 R2 Enterprise
    In my server, i have 2 instances, and I am trying to configure a SQL Server Agent job to query one table in Instance A, and insert some modified data in Instance B, both in the same server.
    When i execute the job in instance A, i get the following error:
    Executed as user: NT SERVICE\SQLSERVERAGENT. Login Failed for user "NT SERVICE\SQLSERVERAGENT". [SQLSTATE 28000] (Error 18456). The step failed.
    I have already configure instance A as Master and disabled encryption, by changing the parameter MsxEncryptChannelOptions to 0 in regedit. I've also made my target instance (instance B) as a Target.
    What am i missing?
    Thanks for your attention and pacience

    Hello,
    The NT SERVICE\SQLSERVERAGENT (virtual) account is not available on the other as you just mentioned. That is the reason for the login
    failed error. Try using a Windows login as the
    SQL Server Agent service account in both servers, the same Windows login (not a virtual account), and run jobs as the “sa” account.
    http://msdn.microsoft.com/en-us/library/ms345578.aspx
    You can also try a proxy account.
    http://technet.microsoft.com/en-US/library/ms190698(v=SQL.105).aspx
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • SSPI handshake failed with error code 0x8009030c and Login failed for user''

    I got the following error when tried to connect to local machine in the
    non-domain environment with Windows Authentication by SSMS.
    "SSPI handshake failed with error code 0x8009030c while establishing a connection with integrated security."
    "Login failed for user''. the user is nothing associated with a trusted SQL server connection."
    questions
    1,if I saw the "SSPI handshake failed ", does it means it must used Kerberos but failed? or it is also possible used the NTLM but failed?
    2,Any ideas for this issue?
    Please click the Mark as Answer button if a post solves your problem!

    Hi Michael,
    Firstly, "SSPI Handshake Failed" error happens usually when connection failed between the server and domain controllers or failed Kerberos authentication. For more details about "SSPI Handshake Failed" error, please review this
    FAQ.
    Secondly, regarding to your error message, it could be caused by loopback check. To resolve the issue, please set the DisableLoopbackCheck registry entry to 1 by performing the following steps.
    1.Click Start, click Run, type regedit, and then click OK.
    2.Locate and then click the following registry subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
    3.Right-click Lsa, point to New, and then click DWORD Value.
    4.Type DisableLoopbackCheck, and then press ENTER.
    5.Right-click DisableLoopbackCheck, and then click Modify.
    6.In the Value data box, type 1, and then click OK.
    7.Exit Registry Editor.
    8.Restart the computer.
    There is a similar blog about your scenario for your reference.
    http://www.bhcblog.com/2009/10/08/fix-for-login-failed-for-user-the-user-is-not-associated-with-a-trusted-sql-server-connection/
    Thanks,
    Lydia Zhang
    If you have any feedback on our support, please click
    here.
    Lydia Zhang
    TechNet Community Support

  • Non-SysAdmins get error 18456 Severity 14 State 11 Login Failed for user _ Reason Token-based server access validation failed with an infrastructure error.

    I have a SQL 2008 R2 system (10.50.4000) where I'm having problems connecting any user that is not a SysAdmin.  Example: I setup a new SQL Login to use Windows Authentication and grant that user db_datareader on the target database.  The user attempts
    to connect using Excel client or Access or SQL Management Studio and receives Error 18456.  The SQL Server Logs shows Error 18456 Severity 14 State 11 Login Failed for user _ Reason Token-based server access validation failed with an infrastructure error.
    The strange part is that if I temporarily grant the user the sysadmin server role then the user can connect successfully and retrieve data.  But, if I take away that sysadmin server role then the user can no longer connect but again receives the Error
    18456 Severity 14 State 11 Login Failed for user _ Reason Token-based server access validation failed with an infrastructure error.
    We've turned off UAC on the client machine to see if that was the problem, but no change.
    I have dropped and re-added the user's SQL Login (and the related database user login info).  No success.
    The Ring Buffers output shows:
    The Calling API Name: LookupAccountSidInternal
    API Name: LookupAccountSid
    Error Code: 0x534
    Thanks for any help.
    -Walt

    Yes, you understand correctly.  The user is logging onto a workstation (not the server) with a Windows Authenticated id.  The user is using either Excel or Access or SSMS and connecting to the server using a Windows Authenticated SQL Login account.
     If the account has sysadmin role (which is only for testing) then the connection is successful.  If I take away sysadmin role from the account then the connection is unsuccessful and the SQL Server Log shows Error
    18456 Severity 14 State 11 Login Failed for user _ Reason Token-based server access validation failed with an infrastructure error.
    (SQL Authentication is not an option here.  I must use Windows Authentication).
    Any other troubleshooting assistance you can offer would be appreciated.  Thanks.
    -Walt 

  • Receiving error message "Login failed for user 'NT AUTHORITY\SYSTEM'" every minute on server which is the mirror

    Hello,
    I have 2 SQL Server 2008 R2 machines that are configured with database mirroring (using certificates as authentication), there is no witness configured.  My issue is that the mirror server is receiving at least one of the below pared messages every
    second and filling up my sql error log quickly.
    SYSTEM is the service account user for the MSSQLSERVER service. 
    [298] SQLServer Error: 4060, Cannot open database "<databasename>" requested by the login. The login failed. [SQLSTATE 42000]
    [298] SQLServer Error: 18456, Login failed for user 'NT AUTHORITY\SYSTEM'. [SQLSTATE 28000]
    The database has a status of: Affected database state is: Mirror, Synchronized/Restoring...
    When I checking the database mirror monitor, it shows that its mirroring ok and everything has green checkboxes.
    Is there a way to stop all these errors being logged, I'm assuming this isn't normal.
    Marcus

    Yes i have faced the same issues and tried everything and nothing was using this account, system was ended up with creating few GB's sql error log files everday.. and finally i had two options, 1 -- Rebuild the instance completely 2. Change the SQL Server
    Audit settings to Only successful logins and restart the instance.. ( May be your current sql server level Audit setting is set to Failed & Successful logins..
    Remeber my server was a DR so I have changed the SQL Server Audit settings to only Successful logins.. but production servers we will monitor both... :)
    Raju Rasagounder Sr MSSQL DBA

Maybe you are looking for

  • Abap select query problem

    This report will take delivery document number and delivery date from user and fetches details from delivery table and fetches corresponding sales order details and billing details  and displays sales order details with ALV list. << Please only post

  • Deleting tracks from library within smart playlists

    I use iTunes 10.6.1 (7) on Mac. I spend some time googling and searching for solutions for my problem, but everything is either outdated or simply doesn't work. I have a smart playlist with all songs that are matched on iTunes Match, but which are be

  • How to restrict maximum 5 part appraisers in the Appraisal template

    Dear All Our requirement is to allow maximum 5 part appraisers in the Appraisal template. Currently the System is calculating & restricting to only 2 part appraisers (as the total columns used is 16). Even on using the BADI - Maximum Number of Part A

  • Document Numbering

    Hi All I am trying to create a different numbering  series in outgoing payment.In  the primary series the first num and next num is 1.In the new series (CD) i am giving 1 for both first and next number and in period indicator i am selecting default a

  • Debug-Mode for Security Realm

    Hi, then i try start the server with the debug mode i get the following exception: Starting WebLogic Server .... <Tue Oct 24 17:45:33 GMT+02:00 2000> <Info> <Management> <Loading configuration file .\config\virtHoDomain\config.xml...> Unable to dump