I have a web service that is being hosted in SharePoint. The WebService is being called from a SharePoint page. When the services is called it uses linq and query the database. When this happens on my local machine everything goes through fine. When performed on a remote machine I get the error:
Login failed for user ‘NT AUTHORITY\ANONYMOUS LOGON’
Is there a way that I can impersonate the user that is being used for the linq call?
Probably your connection string looks like the following:
If so Linq to SQL will use Application Pool’s user.
So you can either give rights to the NT AUTHORITY\ANONYMOUS LOGON so it will be able to access database, or change the Application Pool’s user.
However you could consider to use SQL Server authentication: