VS中的“添加服务引用”失败

时间:2009-04-17 21:46:29

标签: visual-studio web-services

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

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.

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

我做错了什么?


我发现this reference this service有{{3}},事情就是这样。 ( WhyT_不是默认服务吗?

3 个答案:

答案 0 :(得分:2)

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

在我的情况下,我得到了“元数据包含一个无法解析的引用”,因为合同中公开对象使用的某些内部类型不可序列化。

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

因此,您可能想要检查通过合同公开的类型是否可序列化。

答案 1 :(得分:1)

所有(匿名)用户都需要可以访问该服务。您可以使用以下方式访问位置:

<location path="YOURPATH" >
  <system.web>
    <authorization>
      <allow users="*" />
    </authorization>
  </system.web>
</location>

答案 2 :(得分:0)

该服务需要可用。

如果您只启动该服务,则添加服务引用应该有效。