简体   繁体   English

WCF服务可在卡西尼号中使用,但不能在IIS中

[英]WCF service works in cassini, but not in IIS

I created a service that has a database connection which is working fine in Cassini, when in copy the service to the inetpub all works fine except database calls, they always return this error: 我创建了一个具有数据库连接的服务,该服务在Cassini中运行良好,当将该服务复制到inetpub时,除数据库调用外,其他所有功能均正常运行,它们始终返回此错误:

The server encountered an error processing the request. 服务器在处理请求时遇到错误。 See server logs for more details." 请参阅服务器日志以获取更多详细信息。”

Now i have 2 questions, 现在我有两个问题,

  1. I can find server logs in my C:\\inetpub\\logs\\LogFiles\\W3SVC1 folder. 我可以在C:\\ inetpub \\ logs \\ LogFiles \\ W3SVC1文件夹中找到服务器日志。 But are these the ones mentioned because these do not seem to contain any usefull data. 但是这些被提及是因为这些似乎没有包含任何有用的数据。

  2. How is it possible that everything works in Cassini but not in IIS? 一切都可能在Cassini中工作,而在IIS中却无法工作?

If there are any questions about my question please go ahead! 如果对我的问题有任何疑问,请继续!

Edit I am using Visual studio team system 2008 and IIS 7.0 编辑我正在使用Visual Studio Team System 2008和IIS 7.0

This is normally a permissions problem. 这通常是权限问题。

If you are using defaults: 如果使用默认值:

  • The connection string is using a trusted connection 连接字符串正在使用受信任的连接
  • When you run via cassini you are in the security context of your user 通过cassini运行时,您处于用户的安全上下文中
  • When you run via IIS you are in the security context of the identity of the application pool which is network service. 通过IIS运行时,您处于网络服务应用程序池身份的安全上下文中。

To fix it you could: 要解决此问题,您可以:

  • change the connection string 更改连接字符串
  • change the identity of the application pool 更改应用程序池的标识
  • give network service access to your database 授予网络服务访问数据库的权限

My guess is permissions. 我的猜测是权限。 Are you using Windows authentication? 您正在使用Windows身份验证吗?

In the case of Windows authentication: http://www.codeguru.com/csharp/.net/net_security/authentication/article.php/c7725 对于Windows身份验证: http : //www.codeguru.com/csharp/.net/net_security/authentication/article.php/c7725

以管理员身份运行Visual Studio

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

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