简体   繁体   English

WCF服务错误访问数据库

[英]WCF Service Error accessing DB

I have a WCF Service running under IIS 7.0. 我有在IIS 7.0下运行的WCF服务。 The app pool identity is set to a user account lets call it "MyDomain\\MyAcc." 将应用程序池标识设置为用户帐户,可以将其称为“ MyDomain \\ MyAcc”。 I have given "MyDomain\\MyAcc" login permissions to the SQL 2005 Server, and the two DBs that it uses on that server. 我已经为SQL 2005 Server及其在该服务器上使用的两个DB授予了“ MyDomain \\ MyAcc”登录权限。

When I try to invoke one of the WCF methods I get the following in my logs: "Login failed for user 'MyDomain\\MyAcc'..." I have tried removing and re-adding that user on the SQL Server. 当我尝试调用WCF方法之一时,我在日志中得到以下信息:“用户'MyDomain \\ MyAcc'...的登录失败...”我试图在SQL Server上删除并重新添加该用户。

I also tried accessing the DBs from Management Studio running as "MyDomain\\MyAcc" and that worked. 我还尝试了从Management Studio以“ MyDomain \\ MyAcc”身份运行的数据库的访问,并且有效。

What am I missing? 我想念什么?

Finally Figured it out, we are using LINQ to SQL and the last guy who checked the code in commented out the code that we used to pass in the connection string from the web.config file. 最终弄清楚了,我们正在使用LINQ to SQL,最后一个检查代码的人注释掉了我们用来从web.config文件中传递连接字符串的代码。 So it was using the connection string from the dbml file instead. 因此,它改用了dbml文件中的连接字符串。 That connection string was pointing to a DB that the user account did not have access to. 该连接字符串指向用户帐户无权访问的数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM