I am using entity framework and created DBcontext from package manager.. Everything working fine in localhost, when i tried to publish and access the url through postman the above issue happening, I tried lots of options
some body please help. Below is the response which i am getting from the postman { "status": "failure", "message": "Cannot open database "BigDay" requested by the login. The login failed.\r\nLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'.", "data": null }
It is better to define a username and password for the database to which the program is connected and login with it, and the second way, will reduce security a bit.
I will explain both way below
first way:
Then enter this information in the program and connect with this username and password.
second way:
1.Go to SQL Server >> Security >> Logins and right click on NT AUTHORITY\NETWORK SERVICE and select Properties
2.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.
Most cases, this should fix the problem
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.