.net Web服务:无法添加服务引用,只能添加网络引用 [英] .net web service: Can't add service reference, only web reference

查看:188
本文介绍了.net Web服务:无法添加服务引用,只能添加网络引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Web服务的现有项目。一个添加为服务参考,另一个添加为Web参考。我不记得为什么将一个添加为Web参考,但这也许是因为我无法使其正常工作!

I have an existing project that consumes web services. One was added as a service reference, and the other as a web reference. I don't recall why one was added as a web reference, but perhaps it's because I couldn't get it to work!

一个Web的现有服务参考服务工作正常,因此不是.net版本问题。

The existing service reference for the one web service works fine, so it's not a .net version issue.

我可以为第二个Web服务成功创建服务引用,但是没有可用的方法。 .wsdl显示架构,但是Reference.vb仅显示命名空间,没有方法。

I can successfully create a service reference for the second web service, but none of the methods are available. The .wsdl shows the schema, but the Reference.vb shows only the Namespace, and none of the methods.

为澄清起见,这是两个不同的第三方Web服务提供商。

To clarify, these are two different 3rd party web service providers.

我们想移至服务参考,以便在遇到各种超时问题时对配置有更多控制。

We'd like to move to the service reference so we have more control over the configuration as we're having various issues with timeouts.

有人遇到过吗?

编辑

该地址有两个服务是否重要?

Does it matter that there are two services at the address?

编辑

我正在使用.net 3.5和VS2008。

I'm using .net 3.5 and VS2008.

替代文字http://img139.imageshack.us/img139/719/addservicereference.gif

推荐答案

众所周知,添加服务引用功能是猪,并且有很多错误-我经常使用它,但是有时我遇到的问题是它生成的代码要么是这样的(即不存在)

The Add Service Reference feature is notoriously a pig and is buggy - I use it most of the time, but occasionally I hit problems where the code it generates is either like this (i.e. non-existent) or it doesn't reuse types where it should do.

您应该尝试使用svcutil命令行工具(打开VS Command Prompt来运行它)。尽管它类似于VS的参考功能,但实际上是完全不同的代码库。您可以使用它来生成代理,所有客户端类型等,就像使用服务引用功能一样。

You should try using the svcutil command line tool (open a VS Command Prompt to run it), which although it is similar to the reference feature of VS is actually a completely different codebase. You can use that to generate a proxy, all the client-side types etc, just as with the service reference feature.

最重要的是-它几乎可以在所有时间-只要服务本身理智即可。

Most importantly - it seems to work nearly all the time - so long as the service itself is sane.

这篇关于.net Web服务:无法添加服务引用,只能添加网络引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆