I was experiencing a similar error message that I noticed in the Windows Event Viewer that read:
Login failed for user ‘NT AUTHORITY\NETWORK SERVICE’. Reason: Failed to open the explicitly specified database. [CLIENT: local machine]
The solution that resolved my problem was:
- Login to SqlExpress via SQL Server Management Studio
- Go to the “Security” directory of the database
- Right-click the Users directory
- Select “New User…”
- Add ‘NT AUTHORITY\NETWORK SERVICE’ as a new user
- In the Data Role Membership area, select db_owner
- Click OK
Here’s a screenshot of the above: