【问题标题】:WCF web service metadata contains computer nameWCF Web 服务元数据包含计算机名称
【发布时间】:2011-07-28 07:55:04
【问题描述】:

我的 Web 服务托管在我服务器上的 IIS 中,当我尝试下载服务的元数据时,它给了我一个错误:无法解析远程名称:win2008x64(服务器名称)。在服务器上,我有 2 个绑定,一个是 http,另一个是 https..
我该如何解决这个问题?

编辑:

The document was understood, but it could not be processed.
  - The WSDL document contains links that could not be resolved.
  - There was an error downloading 'http://win2008x64:1668/Service.svc?xsd=xsd0'.
  - The remote name could not be resolved: 'win2008x64'
Metadata contains a reference that cannot be resolved: 'http://89.x.x.x:166x/Service.svc?wsdl'.
Metadata contains a reference that cannot be resolved: 'http://89.x.x.x:166x/Service.svc?wsdl'.
If the service is defined in the current solution, try building the solution and adding the service reference again.

提前致谢。

【问题讨论】:

  • a: 客户端可以通过名称ping服务器吗? b:当您在浏览器中浏览到端点时会发生什么?
  • 是的,它当然可以ping通,我可以在浏览器中访问端点,但是它在此页面上显示的内容是:svcutil.exe win2008x64:1667/Service.svc?wsdlwin2008x64 是问题,它应该给出IP ..

标签: c# .net wcf web-services iis


【解决方案1】:

我在 codeplex 上使用 WcfExtras (how to use) 项目来处理此类问题。如果您的服务器位于某种代理之后,这也很有用。您只需要定义一个 location 属性并覆盖您的服务的 url:

<endpointBehaviors>
    <behavior name="Sample.WsdlSampleEndpointBehavior">
      <wsdlExtensions location="http://127.0.0.1/Sample/WsdlSample.svc" />
    </behavior>
  </endpointBehaviors>

【讨论】:

    【解决方案2】:

    尝试使用服务器的 IP 地址生成 wsdl。如果是公共服务器,使用外部 ip (whatsmyip.org),可能只是一个 Dns 问题。

    【讨论】:

    • 尝试使用服务器的 IP 地址生成 wsdl。如何?在客户端,我当然通过 ip 生成代理类..
    • win2008x64:1667/Service.svc?xsd=xsd1,我在我的wsdl里发现了这个,怎么把win2008x64改成ip?
    • 前几天我有一个类似的场景,这家其他企业公开了 WCF 服务,并且它在 wsdl 文件中有服务器名称。我认为使用服务器名称是 wsdl 是 WCF 的默认行为(根据这个线程social.msdn.microsoft.com/Forums/en-US/wcf/thread/…)。我将 svcutil 与服务器的 IP 地址一起使用,它工作正常。如果我错了,请纠正我,但是您真正的问题是不公开服务器的名称吗?
    • 客户端和服务器在不同的网络,所以我通过ip连接到他,而不是计算机的名称..
    猜你喜欢
    • 2013-06-21
    • 2011-06-11
    • 1970-01-01
    • 2010-10-02
    • 1970-01-01
    • 2018-02-25
    • 2016-02-12
    • 2011-02-03
    • 1970-01-01
    相关资源
    最近更新 更多