Showing posts with label principal. Show all posts
Showing posts with label principal. Show all posts

Friday, March 30, 2012

Login failed for user NT AUTHORITY\ANONYMOUS LOGON (but user.identity.name is correct)

I need help. The security principal is the correct Domain\User, but the error message says I am not authenticated.

So here is my error Message:

Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. Me.User.Identity.Name=CompanyDomain\Ryan; System.Security.Principal.WindowsIdentity.GetCurrent=CompanyDomain\Ryan; HttpContext.Current.User.Identity.Name=Company\Ryan

Generated by:

Dim

secPrincAs System.Security.Principal.WindowsIdentity = System.Security.Principal.WindowsIdentity.GetCurrentMe.lblError.Text = ex.Message & vbCrLf & vbCrLf &"Me.User.Identity.Name=" &Me.User.Identity.Name &"; System.Security.Principal.WindowsIdentity.GetCurrent=" & secPrinc.Name &"; HttpContext.Current.User.Identity.Name=" & HttpContext.Current.User.Identity.Name

Here is the Connection String:

Private ConnStringAsString ="Server=10.144.162.111;Database=DNS;Trusted_Connection=True"

IIS has 4 websites hosted on it. The parent level allows anonymous with windows auth off, but the website level has anonymous off with widnows auth and digest.

In IIS, is there a problem with having the parent level anonymous and website level windows auth?

I think i found the error. My web server is a different machine from my data server. When my browser connects to the webserver it uses impersonation and delegation, but the web server is not trusted for delegation on the active directory. So when the webserver tries to pass the credentials to the data server the domain controller will not allow it.

Working on a 3 tier setup here...

Ryan

Monday, March 19, 2012

Login failed connecting to new principal after failover

Hello,

I have setup database mirroring on two Windows 2003 R2 x64 servers using SQL Server 2005 SP1 Developer Edition. Our application is connecting to SQL Server using a SQL Server login. The application is using ADO and SQL Native Client to connect to the server. After a failover, our app attempts to reconnect to the database. The reconnect fails with the error:

Cannot open database "db1" requested by the login. The login failed.

The login is not associated with a user in the new principal database. I run sp_change_users_login to reconnect the user and login. sp_change_users_login says that it fixed 1 orphaned user. Our app then reconnects successfully.

I have tried several failovers, and each time I see the same behavior. The association between the login and user gets lost.

The issue is definitely with the login. I tried using sa to connect to the database, and then our app was able to reconnect after a failover.

Is this a known issue with database mirroring? Is it fixed in SP2?

Thanks,

Heather

Hi Heather. How are you creating the sql logins on the mirror server? If you create them with the same SID as they have on the principal server, that should address the issue. In Sql 2005, you specify the SID for a sql login using the new 'create login' syntax, so it would look something like follows:

create login <loginname> with password = <password>, sid = <sid for same login on principal server>,...

HTH,

|||

Thanks, Chad. That resolved the problem.

Heather

Monday, March 12, 2012

Login error after automatic failover

I have setup a mirror configuration with a witness to be able to use the automatic failover. The principal is DBSP01, the mirror is DBSP02 and the witness is DBSP03. I have an application running an DBCP01. When the mirroring is working, the application can connect to the database on DBSP01. I disconnect dbsp01 from the network, so that DBSP02 becomes the principal. When I try to connect the application to the database on DBSP02, the login fails. Whithout the mirroring I was able to logon to DBSP02, but as soon as it is part of the mirroring, I'm not able to connect to it anymore, whatever the state of the database is. What could be the problem? Can anybody help?

Remco

I hope you are running with safety FULL. Please confirm.

Before you disconnect DBSP01, what is the status of the DBM session? is it SYNCHRONIZED?

After you disconnect DBSP01, are you sure the failover is taking place, and the database DBSP02 has become principal? Please check the role and status.

|||

I found the problem. The services of SQL were not running under the same accounts on the different boxes. One service was running under local account, while the same service was running under the network service account on the other box. When I changed it, it works properly.

Thanks