WCF - WebReferences 不起作用

发布于 2024-08-05 02:27:10 字数 278 浏览 1 评论 0原文

在客户端,我使用 SvcUtil.exe 生成了一个代理,它工作正常。

然后我向客户端程序集添加了 WebReference 并调用相同的方法。但它不起作用。

我的程序正在控制台模式下运行,该方法应该返回一个字符串。它不返回字符串。我只看到一个空白的控制台窗口。没有抛出异常。在方法调用上设置调试点后,我发现程序在方法调用上永远停止。

我应该寻找什么来解决问题?

我用的是VS2005。右键单击客户端项目,然后单击“添加 Web 引用”弹出菜单来添加 webReference。

At the client end, I have generated a Proxy using SvcUtil.exe and it is working fine.

Then I have added a WebReference to the client assembly and calling the same method. But it is not working.

My program is running in console mode and the method is suppose to return a string. It is not returning the string. I just see a blank console window. No exception is thrown. And after setting a debug point on the method call I see that, program is halted on the method call for ever.

What should I look for to solve the problem?

I am using VS2005. And adding the webReference by right-clicking the client project and then clicking "Add Web Reference" pop-up menu.

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

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

发布评论

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

评论(3

无言温柔 2024-08-12 02:27:10

“添加Web引用”和“添加服务引用”不是一回事。后者使用 SvcUtil.exe (或类似的东西,有一个关于

简而言之,一种是使用 WCF 框架,另一种是使用 ASP.NET WebService 的东西(wsdl.exe)。看起来很奇怪的是,该服务在 SvcUtil 上运行良好,但在 wsdl.exe 上运行不正常。另一种方式可能会发生在与 DataContractSerializer 不兼容的 WSDL 上,但我从来没有遇到过 wsdl.exe 不起作用的情况...

您可能想使用 WcfTestClient,也许还可以安装适用于 Visual Studio 2005 的 .NET 3.0 工具,请参阅 此处

"Add Web Reference" and "Add Service Reference" are not the same things. The later uses SvcUtil.exe (or something simillar, there is a discution about that here).

In short, one is use WCF framework the other one is using ASP.NET WebService stuff (wsdl.exe). It seems very strange that the service works fine with SvcUtil and not with wsdl.exe. The other way arround can happen with WSDL that are not compatible with DataContractSerializer, but I never had the cas where wsdl.exe didn't work...

You may want to test the service with theWcfTestClient, and maybe install the .NET 3.0 tools for Visual Studio 2005, see here.

一桥轻雨一伞开 2024-08-12 02:27:10

添加 Web 引用不会添加 WCF 代理,而是添加使用旧的 WCF 之前的 API 的代理。

根据服务的绑定,这些旧代理可能无法工作。基本上,它们仅在服务使用 BasicHttpBinding 时才起作用。

不能使用SvcUtil生成的代理来代替吗?

Add Web Reference does not add a WCF proxy, but rather a proxy that uses the old, pre-WCF API.

Depending on the binding on the service, those old proxies may not work. Basically they only work if the service is using BasicHttpBinding.

Can't you use the proxy generated by SvcUtil instead?

古镇旧梦 2024-08-12 02:27:10

VS 2005 最初是为框架 2.0 制作的。

为了使其与 WCF 一起使用,您需要:“The Visual Studio 2005 extensions for .NET Framework 3.0”

VS 2005 was originally made for framework 2.0.

For it to work with WCF you need: "The Visual Studio 2005 extensions for.NET Framework 3.0"

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