WCF 故障日志记录和 SQL 异常 4060 错误

发布于 2024-09-05 23:35:59 字数 753 浏览 5 评论 0原文

几天来,我一直在尝试从 Juval Lowy 的网站(Programming WCF Services 的作者和 IDesign 的创始人)编译/运行示例 WCF 应用程序。该示例应用程序利用 Juval 的 ServiceModelEx 库,该库将故障/错误记录到“WCFLogbook”SQL 数据库。不幸的是,当示例应用程序出现故障时,我收到以下错误:

SQL 异常 4060:“无法打开数据库 登录请求的“WCFLogbook”。 登录失败。\r\n登录失败 用户“Bill-PC\Bill”。”

我确认已创建 SQL WCFLogbook 数据库,并已授予我 (Bill-PC\Bill) 访问该数据库的所有适当权限。此外,端口 8006 和端口 1433 已被授予在防火墙中打开。TCP/IP 已启用,并且已选中“允许远程连接到此服务器”。我在 App.Config 文件中使用以下端点:

<client>
     <endpoint name="LogbookTCP"
        address="net.tcp://Bill-PC:8006/LogbookManager"
        binding="netTcpBinding"
        contract="ILogbookManager"
     />
</client>

不幸的是,SQL 是一个我不需要的“世界”。在此之前,我对自己的失败感到非常沮丧,是否有人对我是否错过了任何其他建议?

I have been attempting to compile/run a sample WCF application from Juval Lowy's website (author of Programming WCF Services & founder of IDesign) for several days. The example app utilizes Juval's ServiceModelEx library which logs faults/errors to a "WCFLogbook" SQL database. Unfortunately, when the sample app faults, I get the following error:

SQL Exception 4060: "Cannot open database
\"WCFLogbook\" requested by the login.
The login failed.\r\nLogin failed for
user 'Bill-PC\Bill'."

I confirmed that the SQL WCFLogbook database has been created and have granted all of the appropriate permissions for my (Bill-PC\Bill) access to the database. Additionally port 8006 and port 1433 have been opened in the Firewall. TCP/IP has been enabled and "Allow remote connections to this server" has been checked. I am using the following endpoint within the App.Config file:

<client>
     <endpoint name="LogbookTCP"
        address="net.tcp://Bill-PC:8006/LogbookManager"
        binding="netTcpBinding"
        contract="ILogbookManager"
     />
</client>

Unfortunately SQL is a 'world' that I hadn't needed to venture into before now and I am terribly frustrated with my lack of success. Would anyone have any other suggestions on how to get this working? Have I missed anything?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

骄傲 2024-09-12 23:35:59

无法打开数据库“WCFLogbook”
登录请求

错误消息非常清楚。我理解您的沮丧,但我首先相信错误消息,然后相信您的调查。错误消息表明数据库不存在,或者无法打开,或者用户无权访问它。您必须逐步验证:

  • 您的 WCF 服务连接到您期望的 SQL Server 实例
  • 您要连接的 SQL Server 实例上存在该数据库 WCFLogbook。请注意,如果您安装了区分大小写的排序规则实例,则名称区分大小写。
  • 数据库 WCFLogbook 处于联机状态,
  • 允许登录 Bill-PC\Bill 连接到该数据库。

Cannot open database "WCFLogbook"
requested by the login

The error message is pretty clear. I understand your frustration, but I trust the error message first and your investigation second. The error message says the database does not exists, or it cannot be opened, or user has no access to it. You must validate step by step that:

  • your WCF service connects to the SQL Server instance you expect
  • the that database WCFLogbook exists on the SQL Server instance you are connecting to. Note that if you installed a case sensitive collation instance, then the name is case sensitive
  • the database WCFLogbook is online
  • the login Bill-PC\Bill is allowed to connect to the database.
饮湿 2024-09-12 23:35:59

SQL 异常 4060:“无法打开登录请求的数据库 \"WCFLogbook\"。登录失败。\r\n用户“Bill-PC\Bill”登录失败。”

很明显,您已经您的数据库登录错误。异常抛出在哪里?在您的客户端应用程序中还是在您的 WCF 服务调用中?

我问这个问题的原因是为了向您指出调试的位置;如果异常来自 WCF 调用上的错误契约,则很可能发生在服务本身中。如果它在客户端应用程序上,那么显然这就是问题所在。

您使用什么版本的 SQL?如果您有 SQL Express,那么默认情况下您应该有足够的权限来运行该应用程序。您的用户是管理员吗?您可能需要以管理员身份打开数据库,然后确保 Bill-PC\Bill 具有登录名并且已映射到 WCFLogbook 数据库中的 dbo 架构。

SQL Exception 4060: "Cannot open database \"WCFLogbook\" requested by the login. The login failed.\r\nLogin failed for user 'Bill-PC\Bill'."

It's fairly clear you have a login error to your database. Where is the exception throwing? In your client app or in your WCF Service call?

The reason I ask is to point you at where to debug; if the exception is coming from a fault contract on the WCF call, it's most likely occurring in the service itself. If it's on the client app then obviously this is where the issue is.

What version of SQL are you using? If you have SQL Express then by default you should have sufficient permissions to run the app. Is your user an administrator? You may need to open the database as an admin and then ensure that Bill-PC\Bill has a login and has been mapped onto the dbo schema in the WCFLogbook database.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文