WCF 客户端 - 为什么我会收到此错误?

发布于 2024-11-14 22:13:10 字数 571 浏览 2 评论 0原文

我正在尝试使用网络服务(https/ssl/basicHttpBinding)。我添加服务引用没有问题并异步调用它。我将客户端的实例传递给回调。当尝试从回调中的服务获取结果时,我收到此错误:

标题 http://schemas.xmlsoap.org/ws/2004/08/addressing:Action 对于最终收件人是必需的,但是 消息中不存在。

var Result = client.BeginTheServiceOperation(header, CallBack, client);

private static void CallBack(IAsyncResult ar)
{
   var client = ar.AsyncState as MyServiceSoapClient;
   var result = client.EndTheServiceOperation(ar); // ERROR OCCURS HERE
   Console.WriteLine(result);
}

我缺少什么?

谢谢

I am trying to use a web service (https/ssl/basicHttpBinding). I add service reference without issues and call it asynchronously. I pass the instance of the client to the CallBack. I get this error when trying to get the result from the service at the CallBack:

Header
http://schemas.xmlsoap.org/ws/2004/08/addressing:Action
for ultimate recipient is required but
not present in the message.

var Result = client.BeginTheServiceOperation(header, CallBack, client);

private static void CallBack(IAsyncResult ar)
{
   var client = ar.AsyncState as MyServiceSoapClient;
   var result = client.EndTheServiceOperation(ar); // ERROR OCCURS HERE
   Console.WriteLine(result);
}

What am I missing?

Thanks

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

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

发布评论

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

评论(2

江城子 2024-11-21 22:13:11

这表明您尚未将正确的消息配置选项应用于您的绑定。该服务需要一个带有 WS-Addressing 标头的 SOAP 消息,但显然您的客户端没有传递它们。由于默认绑定会传递它们,因此我必须假设您已经以某种方式更改了绑定,从而阻止它们被传递。

如果需要更多帮助,请将您的绑定配置代码/配置 XML 添加到原始帖子中。

This is an indication that you have not applied the the proper message configuration options to your binding. The service is expecting a SOAP message with WS-Addressing headers, but apparently your client is not passing them. Since the default binding would pass them, I have to assume you've changed your binding in some way that would prevent them from being passed.

If more assistance is required, please also add your binding configuration code/config XML to the original post.

妥活 2024-11-21 22:13:10

事实证明,该服务需要 SOAP 1.1,而默认情况下 WCF 使用 SOAP 1.2。我需要创建一个新的自定义绑定,传递该配置,一切正常。这为我指明了正确的方向:http://social.msdn.microsoft.com/Forums/en/wcf/thread/f3707303-4f35-4079-ac0b-eba4717cada8

It turns out that the service was expecting SOAP 1.1 and by default WCF uses SOAP 1.2. I needed to create a new custom binding, passing that configuration in and it all worked ok. This pointed me in the right direction: http://social.msdn.microsoft.com/Forums/en/wcf/thread/f3707303-4f35-4079-ac0b-eba4717cada8

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