“添加服务参考"在 VS 中失败 [英] "Add Service Reference" is failing in VS

查看:29
本文介绍了“添加服务参考"在 VS 中失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 MS 的 Visual Web Developer 中,我有一个完全默认的 ASP.NET Web 服务项目和另一个项目.当使用第二个项目的右键菜单运行添加服务引用"时,我可以找到列为选项的第一个项目,但是当我尝试选择它时出现错误,出现错误

<前>元数据包含无法解析的引用:http://0.0.0.0:3495/Service1.asmx?wsdl".下载http://0.0.0.0:3495/Service1.asmx?wsdl"时出错.无法连接到远程服务器请求的地址在其上下文 0.0.0.0:3495 中无效元数据包含无法解析的引用:http://localhost:3495/Service1.asmx".元数据包含无法解析的引用:http://localhost:3495/Service1.asmx".如果在当前解决方案中定义了服务,请尝试构建解决方案并再次添加服务引用.

我在使用 WCF 服务时也遇到了同样的问题.

我做错了什么?

<小时>

我发现这个参考此服务 与此相关.(为什么T_默认服务不能正常工作?)

解决方案

由于未生成代理,因此未添加引用.

就我而言,我得到了元数据包含无法解析的引用",因为合约上公开的对象使用的某些内部类型不可序列化.

应用 Serializable 属性后,代理正确生成并添加了引用.

因此,您可能需要检查通过合约公开的类型是否可序列化.

In MS's Visual Web Developer, I have a completely default ASP.NET web service project and another project. When use the right click menu on the second project to run "Add Service Reference", I can find the first project listed as an option but I get an error when I attempt to select it, I get an error

Metadata contains a reference that cannot be resolved: 'http://0.0.0.0:3495/Service1.asmx?wsdl'.
There was an error downloading 'http://0.0.0.0:3495/Service1.asmx?wsdl'.
Unable to connect to the remote server
The requested address is not valid in its context 0.0.0.0:3495
Metadata contains a reference that cannot be resolved: 'http://localhost:3495/Service1.asmx'.
Metadata contains a reference that cannot be resolved: 'http://localhost:3495/Service1.asmx'.
If the service is defined in the current solution, try building the solution and adding the service reference again.

I have gotten the same problem when using WCF services also.

What am I doing wrong?


I found this reference that has this service and things work with that. (WhyT_ doesn't the default service just work?)

解决方案

The reference is not getting added since the proxy is not getting generated.

In my case I got the "Metadata contains a reference that cannot be resolved" since some of the internal types used by the exposed object on the contract were not serializable.

After applying the Serializable attribute, the proxy generated correctly and a reference was added.

So you might want to check if the types exposed over the contract are serializable.

这篇关于“添加服务参考"在 VS 中失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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