嵌套WCF服务调用不起作用?

发布于 2024-12-04 10:55:30 字数 584 浏览 6 评论 0原文

我有许多 WCF 服务,它们是从 ASP.NET MVC 应用程序调用的特定功能。

  1. MVC 应用程序
  2. 在其处理过程中调用 Contract-Service(WCF 服务) Contract-Service 调用 Contract-Buy-Service(WCF 服务) Service)
  3. Contract-Buy-Service 调用 SAM-Utility-Service(WCF 服务)

当我从 Contract-Buy-Service 运行 TDD 测试用例时,它工作得很好。因为调用是从 Contract-Buy-Service 转到 SAM-Utility-Service。但是当电话从 合同服务 =>合同购买服务 => SAM-实用程序-服务 我总是收到这样的错误:在配置中找不到 SAM-Utility-Service 的端点。

在合同购买服务和合同服务中都有 SAM-Utility-Service 的服务参考。我已检查该服务是否已托管并且已启动并正在运行。当我尝试通过浏览器查看时,我可以获得 WSDL。

有人可以告诉我为什么服务调用不经过多层或者我在这里做错了什么?

谢谢!

I have a number of WCF Services which are called for a certain function from an ASP.NET MVC application.

  1. The MVC app calls Contract-Service (WCF Service)
  2. Contract-Service during its processing calls Contract-Buy-Service (WCF
    Service)
  3. Contract-Buy-Service calls SAM-Utility-Service (WCF Service)

When I run my TDD test cases from Contract-Buy-Service, it works perfectly fine. Because the call goes from Contract-Buy-Service to SAM-Utility-Service. But when the call goes from
Contract-Service => Contract-Buy-Service => SAM-Utility-Service
I always get the error that the endpoint for SAM-Utility-Service is not found in the config.

There is a service reference for SAM-Utility-Service in both the contract-buy-service and contract-service. I have checked that the service is hosted and is up and running. I can get the WSDL when I try to view through browser.

Can someone tell me why the service call does not go through multiple layers or am I doing something wrong here?

Thanks!

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

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

发布评论

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

评论(1

花开柳相依 2024-12-11 10:55:30

首先,我认为合同服务不需要服务参考或 SAM 实用程序服务的任何知识。除非它需要直接与该服务通信以进行其他操作 - 在这种情况下我建议使用另一个服务端点无论如何 - 它不应该知道合同购买服务正在做什么。这会导致服务的耦合更加紧密,从而消除了面向服务的主要优势之一。

问题的原因可能有很多(WCF 总是如此)。然而,由于错误的选择、不正确的使用或交易的错位,我也遇到过类似的问题。

例如,考虑合同服务和合同购买服务参与交易。 SAM-Utility-Service 也可能需要事务,但需要新事务。如果第二个事务没有正确参与第一个事务,则第一个事务可能不允许它提交或者可能不会提交自己。

第一步可能是让这三者在没有任何交易的情况下协同工作。

To begin with, I don't believe the Contract-Service should need a service reference or any knowledge of the SAM-Utility-Service. Unless it needs to directly communicate with that service for some other operation - in which case I'd suggest another service endpoint anyway - it shouldn't know about what the Contract-Buy-Service is doing. This is leading to tighter coupling of your services which removes one of the major benefits of service-orientation.

The cause of your problem could be a number of things (as is always the way with WCF). However I've had similar problems to this caused by bad choice, incorrect use or misalignment of transactions.

Consider that, for example, Contract-Service and Contract-Buy-Service participate in a transaction. SAM-Utility-Service may also require a transaction, but requires a new transaction. If this second transaction doesn't participate in the first transaction correctly, then the first transaction may not allow it to commit or may not commit itself.

One first step could be to get all three working in concert without any transactions.

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