Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"ASP.NET" error: Access to the remote server is denied because no login-mapping exists

I'm able to execute a stored procedure which queries a Linked Server directly, but when I call the same sproc though ASP.NET then I get the following error:

Access to the remote server is denied because no login-mapping exists.

When I execute it through SSMS, I am connected through my Windows domain account.

The site is ASP.NET with Forms Authentication on IIS 7 and SQL 2008 on my local machine.

The Linked Server is set up to "Be made using this security context" for all logins.

like image 886
Even Mien Avatar asked Feb 28 '23 17:02

Even Mien


1 Answers

The login that you connect with to your initial database does not have access to the linked database. Why don't you use the account that the application impersonates to connect to the database in Management Studio, and diagnose the issue that way? If you know the login, just create it in the linked database as well with the required permissions.

If creating a new login on the linked server is not an option, create a mapping. If you read the fine print on the wizard, it says "for logins not defined in the list above, connections will be made" using the current security context. Which means that if you don't define a mapping, it will use the current credentials for the link.

like image 155
cdonner Avatar answered Mar 05 '23 00:03

cdonner