SharePoint 2013 includes ‘follow’ feature in its social networking module (My Sites). We can follow sites, people, even documents. This morning we tried this feature to follow a document, but we got the following error: Something went wrong. Sorry, we couldn’t follow the document.
If we click Technical Details provided on the bottom part of the error dialog box, there’s a rather long error description: InternalError: Could not follow http://pena-dev2/sites/Dev1/Shared Documents/Project Document A.docx. But this longer technical detail still doesn’t provide technical support with any hint about what is wrong inside the SharePoint box.
Usually when an error happens in SharePoint, there is a correlation token displayed below the error message. This correlation token can help technical support or developer to find the technical details inside SharePoint log files. This time, we couldn’t find this correlation token in the error dialog box. Nevertheless, we as developers, still must look inside SharePoint log files to search for details of the error.
Then we found the following real technical error message from the most recent log entries:
Cannot open database “SP15_Content_MySites” requested by the login. The login failed. Login failed for user ‘PENA\SP_PortalAppPool’
We know our development environment well. We know that SP15_Content_MySites is the content database for our SharePoint My Site web application. We also know that PENA\SP_PortalAppPool is the application pool account for our SharePoint web application containing the failed document. From this facts, we conclude that the application pool account for SharePoint web application needs to have certain permission to My Sites content database.
The question now is what kind of permission?
In our development we have included the account in db_Owner role for My Sites content database and the problem has gone. But, in production environment, we have to grant permissions no more than what the account needs. The account doesn’t have to be in db_owner role for this purpose. In SharePoint 2013, there is SPDataAccess role, which is recommended by Technet as the role that should be used for this purpose.
We can use SQL Server Management Studio to grant SPDataAccess role to SP15_Content_MySites database.