Friday 18 July 2008

Login failed for user NT AUTHORITY\NETWORK SERVICE

I've just been banging my head against a brick wall, and unfortunately, trawling through a lot of nonsense written on various forums about what to do when you see this:

Cannot open database "slcms" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.


Let's say your connection string looks like this:

Data Source=MYHOST;Initial Catalog=MyDatabase;Integrated Security=True;User ID=myUser;Password=myPassword

This: Integrated Security=True; and this: User ID=myUser;Password=myPassword are mutually exclusive.

Integrated security means 'use my domain credentials'

User ID=myUser;Password=myPassword means 'use these SQL credentials'

So SQL Server can't decide between them.

Solution: Remove this bit : Integrated Security=True;

No comments: