开发者

ASP.NET accessing a SQL Server in a different server

I have installed a new web application that access a SQL Server database in a different server. I'm using Windows Authentication and get the error of:

Login Failed for user XXX

When I try to set identity impersonate="true" in the web.config file, it just throws an error

Login Failed for anonymous user

Also, I'm using开发者_开发技巧 forms authentication to validate users from my website and using a different application pool.

Update: connection string Basically like this:

Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;

Update:

My Virtual Directory has Anonymous Authentication and Windows Authentication enabled.


Typically ASP.NET runs as an anonomous account. In order to access a remote SQL Server using integrated authentication (SSPI), you'll need to have a bit more "permenant" presence. Easy way would be to shift the app pool to use the NETWORK SERVICE built-in account. Slightly trickier would be to use a named account. On the SQL server side of the equation you will need to give the same account -- either matching user/pass or NETWORK SERVICE -- proper permissions to your database.

Your DBA should be able to help.


It is difficult to provide you with an exact answer because you have not provided your connection string or info on your SQL Server config. Your best bet is to look at the IIS configuration and work out what user is attempting to access the different SQL Server. You then need to give this account access to the database. This is a common problem and most of the changes need to happen in SQL Server unless you can change the account that the web server is running under.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜