如何更改WSDL的地址?

时间:2011-01-05 15:29:49

标签: wcf wsdl

我在Web应用程序的IIS中托管简单的WCF服务。

<system.serviceModel>
  <behaviors>
    <serviceBehaviors>
      <behavior name="SimpleServiceBehavior">
        <serviceMetadata httpGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="false" />
       </behavior>
    </serviceBehaviors>
  </behaviors>
<services>
  <service behaviorConfiguration="SimpleServiceBehavior" name="SimpleService">
  <endpoint address="" binding="basicHttpBinding" contract="ISimpleService" />
  <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>

当我运行托管在http://projects.mydomain.com/application/SimpleService.svc上的服务时,它会显示带有WSDL链接的默认服务页面: svcutil.exe http://terminal.mydomain.local/application/SimpleService.svc?wsdl等等

客户端可以创建服务引用但无法执行方法,因为无法解析主机名terminal.mydomain.local 问题是为什么服务器名称是其本地名称'terminal.mydomain.local'而不是'projects.mydomain.com'?

1 个答案:

答案 0 :(得分:2)

我找到了回答:http://forums.asp.net/p/1096811/1659596.aspx 我需要更改主机头。