Recently I run into a problem where NAV service did shut down every time I did add or delete a user.
The event log explain the problem like bellow. So it obvious that we of some reason can’t connect to the database.
Source: .Net SqlClient Data Provider
Message: The server principal "XX\YY" is not able to access the database "ZZ" under the current security context.
When looking at the security for database “ZZ” I found the same problem as the event log was pointing at, no trace of user “XX\YY” with gives the NAV service access to the database. It turns out that when adding or deleting a NAV user all user privileges is re-synced, and any user not part of the new list is deleted. And if the NAV service account is not part of the user list, NAV service can’t longer connect to database.
The solution is very simple. You have to make sure that the service account is added as a user in NAV under Tools - Security - Windows Logins. Followed by syncing logins.