views:

32

answers:

2

Hi,

I have an application that uses a database on SQL Server and I want users to connect to that server using integrated windows authentication. The connection string is:

SqlConnection scn = new SqlConnection("Data Source='server name';Initial Catalog=temp;Trusted_Connection=true;Integrated Security=SSPI");

When I run the application from my pc it works just fine and it recognizes my user name. But when I run it from the server then it gives me the following error:

Login failed for user 'domain\server Name$'.

As I understand it doesn't recognize the user name and thinks that the user name is the server name.

Any idea how to fix it?

Thanks in advance,

Greg

A: 

Use runas to have the application run with the correct credentials.

Oded
+1  A: 

The application correctly connects as the server machine account. Processes running as LocalSystem or as Network Service authenticate over the network as the machine, domain\machine$, this is by design, intentional and desired.

You can grant domain\server$ login rights into SQL as needed. Or you can change the application to run under a different account (I assume the application is a service?).

Remus Rusanu