开发者

Integrated windows authentication to SQL Server

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?


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?).


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜