开发者

Did not recognize the correct database after WCF project host in IIS 7

A WCF project consist of all the logic behind a desktop application (WPF) and it works well when I run it on VS 2008 with WCF selfhost. The desktop application consume 开发者_开发技巧services expose by the WCF and desktop application users have to login to the app using his username and password. WCF is connect with SQL Server 2008 database through LINQ and user account details also save in that database.

But after I host that WCF in IIS 7, when I login to the desktop application, it says username and password are not match. But It worked perfect in VS 2008 with self host before I host WCF in IIS 7. What is the reason for this behavior?

Please help me to solve this problem

Connection string for SQL Server database:

<add name="iSponsor.Data.Properties.Settings.test_dbConnectionString" 
     connectionString="Data Source=LMR-HERO\SQLSP1INS;Initial Catalog=test_db;Integrated Security=True" 
     providerName="System.Data.SqlClient" />


You're using integrated security. That means that the WCF service will attempt to log into the database using the IIS application pool identity.

You will either need to

  1. grant the default app pool users (or more conveniently the local group IIS_IUSRS) permissions to access your database - needs carefully locked-down access, though, but very difficult for an attacker to impersonate this user
  2. run the application pool as a local or domain user who does have access to the database - again need to carefully lock down this user
  3. use SQL server authentication instead (username / password) - simplest to set up but easiest to attack
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜