System.Data.SqlClient.SqlException: Login failed for user 'domain\user'.

Tom McDonald
Tom McDonald used Ask the Experts™
on
I am using trusted connections and I have configured IIS 7 to use connect as a specific active directory user.  However, when it connects it doesn't use the user I set up for it (see attached image).  It connects with the machine name!  The error I get is:

 System.Data.SqlClient.SqlException: Login failed for user 'AD\MYComputer$'.

In the error 'AD\MyComputer' is the name of my development laptop. Why isn't it connecting as the user I specified?  How do I fix it?
   connect as iis
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Is the "connect as" used for SQL or is it only your web server settings?
Do you have (another) connectionstring in a web.config file or something?
Tray896SharePoint Engineer

Commented:
The connect as that your image shows is only to connect to a directory, not to a database that is part of your application.  The error indicates an issue trying to connect to SQL.  Try modifying your application pool to run as this domain user by clicking on Application Pools, select the catsmerge app pool, and then click on advanced settings.  From there you can modify the identity so that it runs under the domain account.
Top Expert 2013
Commented:
If you are denying anonymous access + have impersonation enabled then....it will pass your Current windows identity and not the one you created.
can we see your web.config as here?
Tom McDonaldDeveloper

Author

Commented:
You're right, I didn't realize it, but I had the web.config identity impersonate set to true.  I set it to false and then the correct identity was passed

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial