2009-04-17 85 views
1

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

 
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 referencethis service和事情的工作。 (WhyT_不默认服务只是工作?

回答

0

该服务需要可用。

如果你只是开始服务,添加服务引用应该工作。

+0

没有喜悦,按Ctrl-F5似乎开始服务,但我仍然得到同样的错误,如果只是F5变灰“添加服务”选项,并IIRC没有工作,即使我在另一个VS会话中打开相同的解决方案。 – BCS 2009-04-17 21:53:14

+0

嗯......你可以尝试使用IIS来调试你的服务,然后尝试添加引用。 – 2009-04-17 21:55:32

2

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

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

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

因此,您可能想要检查合约中暴露的类型是否可序列化。

1

该服务需要可供所有(匿名)用户访问。您可以访问的位置使用:

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