Here is one of the errors I encountered while I was working in Dynamics AX 2012. The complete error message is:
Cannot open database requested by the login. The login failed.Login failed for user ‘NT AUTHORITYNETWORK SERVICE’.
This error normally occurs when the application has been configured with the IIS and IIS does not have proper credentials to access SQL.
Here is a quick solution to solve this error. Open SQL Server Management Studio and go to the Security->Logins and right click on NT AUTHORITYNETWORK SERVICE.Right click on it and select Properties. A new screen will appear. Go to “User Mapping” and select your desired database. In the Database role memberships, tick the “db_owner” checkbox. Click Ok and restart your AX service.