SqlException: Login Failed For User 'NT AUTHORITY\NETWORK SERVICE
Solution 1:
You will need to actually create an account in SQL Server for the Network Service account. Then you will grant it access to your database, the specific permissions that you grant the account depend on the nature of the tasks that your database needs to do.
You can do this all in SSMS via the "Security" section, right click on "Logins" and select add. You will be adding a Windows Account, you can then lookup and validate the name "NETWORK SERVICE". Then switch to the "User Mapping" section and grant permission to view your database. The permissions as I said are up to you, or you can assign it dbowner permissions for full control.
After doing that you will be fine. I do caution against giving the application more permissions than needed!
Solution 2:
Personally I would run the Web app under a custom service account. If you really want to run it under Network Service- see this MSDN document.
Solution 3:
As you specify "integrated security=sspi" in connection string than I guess you expect impersonating. But for this you should: 1. turn on integrated auth in IIS 2. turn on windows auth in asp.net: 3. turn on imerposation in asp.net:
Also consider that it's not enough if you web server and SQL Server machine are different machines. Then your users' account will be required to be trusted for delegation. It's special option in AD.
So, you have been said already it's better to have separated account for SQLSRV connections. Hope this helps.
Solution 4:
I recommend creating a service account and have your IIS 7 process run as that account. Make sure that account has proper access to the DB (if it just reads then DB-REader) (if it reads and updates then DB-Reader and DB-Writer).
Solution 5:
I encountered the same error with a fresh IIS setup. I used "integrated security=false;User Id=sa;Password=yourpassword" and everything worked just fine.
Post a Comment for "SqlException: Login Failed For User 'NT AUTHORITY\NETWORK SERVICE"