I developed a window service app which runs on the SP server that copy files from the Safe to the SP.
The service is running under a app user which is administrator on the SP server and is site collection administrator on the site it is trying to access.
When I run the service I am receiving an “SQL database login failed. Additional error information from SQL Server is included below. Login failed for user “
I can access the site through the browser with the specified user.
I am not getting this error when I ran the service under my user (I am administrator on the server and site collection administrator on the site)
The error occurred on the following line:
Using(SPsite site = new SPSite(<the url to the site>)
{
}
I added The user as administrator to the DB server and the problem was solved.