6

我让我的 WCF 服务使用 HTTPS 运行,它显示了信息页,但“要测试此服务,...使用以下语法:”下面的 URL 是:

svcutil.exe https://servername.group.service.com/MyService.svc?wsdl(服务器的完整地址)

而不是正确的 URL https://my.service.com/MyService.svc?wsdl(分配的主机头),我怎样才能让它显示正确的 URL(<URL of the Service> + ?wsdl)?

<services>
  <service name="MyService" behaviorConfiguration="MyServer.MyServiceBehavior">
    <endpoint binding="basicHttpBinding" bindingConfiguration="basicHttpBigStrings" contract="IMyService">
    </endpoint>
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="MyService.MyServiceBehavior">
      <serviceCredentials>
        <serviceCertificate findValue="my.service.com" x509FindType="FindBySubjectName"/>
      </serviceCredentials>
      <serviceMetadata httpsGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <basicHttpBinding>
    <binding name="basicHttpBigStrings">
      <security mode="Transport">
        <transport clientCredentialType="None"/>
      </security>
      <readerQuotas maxStringContentLength="1048576" />
    </binding>
  </basicHttpBinding>
</bindings>

我已经尝试更改<serviceMetadata httpsGetEnabled="true"/>为,但它只是说:“URI https://my.service.com/MyService.svc<serviceMetadata httpsGetEnabled="true" httpsGetUrl="https://my.service.com/MyService.svc"/>的注册已经存在”

4

2 回答 2

4

您指定您已设置主机标头。它是为 SSL 设置的还是只是为 Http 设置的。请记住,IIS UI 没有为 SSL 设置 Host-header 的字段。对于更高版本的 IIS,您需要使用管理脚本 (IIS 6.0) 或 netsh.exe。

于 2010-11-23T16:40:19.183 回答
0

你可以在下面的 StackOverflow链接中找到一些背景知识——我会尝试的第一件事(他们给出了几个涉及更多的不同场景)是在服务端点定义上设置监听 URI。当我在我的应用程序中正确获取 WSDL 地址时遇到问题,我可以设置它来纠正它。在那种情况下,我只是试图修复该方案(我们在 BIGIP 之后并且它正在终止 SSL,因此该方案需要是 https,即使服务器端的 WCF 认为它正在获取 http)。

<endpoint address="https://www.sslloadbalancer.com" binding="someBinding" contract="IMyServiceInterface" listenUri="http://www.servicehost.com" ...  />

我相信这将为您修复 WSDL

于 2010-11-12T18:42:44.837 回答