This error is quite common and I have received it few times while I was working on a recent consultation project.
Cannot open database requested by the login. The login failed.
Login failed for user ‘NT AUTHORITY\NETWORK SERVICE’.
This error occurs when you have configured your application with IIS, and IIS goes to SQL Server and tries to login with credentials that do not have proper permissions. This error can also occur when replication or mirroring is set up.
If you search online, there are many different solutions provided to solve this error, and many of these solutions work fine. However, I will be going over a solution that works always and is very simple.
Fix/Workaround/Solution:
Go to SQL Server >> Security >> Logins and right click on NT AUTHORITY\NETWORK SERVICE and select Properties
In newly opened screen of Login Properties, go to the “User Mapping” tab. Then, on the “User Mapping” tab, select the desired database – especially the database for which this error message is displayed. On the lower screen, check the role db_owner. Click OK.
In almost all such cases, this should fix your problem.
Reference : Pinal Dave (https://blog.sqlauthority.com)
225 Comments. Leave new
hi i install the SQL server express 2005 also management studio regarding hospital management soft and my database are connected with P data but when i open application the error is appraiser
i install net framework 1.0.3 and also fretwork 4.5.1 with windows 7 pro 32 bit but i could not open my application. Cannot open database “” requested by the login. The login failed. Login failed for user ‘sa’
i also check in database sa properties regardin woner check mark its done but i did not open application plz help me any one
Worked for me, shot and sweet!
Thanks
Great help for me today
Thanks
Hoa
Like it, working fine thanks. just remove dbo from user.
Excelent!!!! you saved my Job
Error = [Microsoft][SQL Server Native Client 10.0][SQL Server]Cannot open database “aaa” requested by the login. The login failed.
I use SQL native client 9 and Windows authentication… I don’t find NT AUTHORITY \NETWORK.. Please help me sir :(
[HELP] Cannot open database “database name” requested by the login. The login failed. Login failed for user “user name”
check this may be solved your problem ..
Thank you so much for ALL the articles you presented. YOU ARE THE MAN!
thank you so much for the article. it help me alot
It really worked for me. Thank you
Too good. I have tried many thing but nothing was working! This worked for me!
Dear Sir,
inside my sql server management 2008, there are not available NT AUTHORITY\NETWORK SERVICE in security –> login..
could you give me a suggestion about it ?
Thanks,
You are a genius man. you just solved my problem! God bless you
can you please help to resolve this issue: a transport-level error has occurred when sending the request to the server. (provider: shared memory provider, error: 0 – No process is on the other end of the pipe
Great Solution, Problem solved, Thanks you
-Krishna
Thanks!
What to do if there is no database with the given name?
I generally use SQL profiler.
thank you sir
Welcome @bikari
Great Solution, Problem solved, Thanks you
thanks a lot my lord, that’s work!! :D