WCF web服务元数据包含计算机名

本文关键字:计算机名 数据包 元数据 web 服务 WCF | 更新日期: 2023-09-27 18:03:52

我的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.

提前感谢。

WCF web服务元数据包含计算机名

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

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

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