如何配置WCF服务以在没有HTTP绑定的情况下通过HTTPS工作?

Dmi*_*rii 18 .net iis wcf web-config

我已将WCF服务配置为使用SSL,但仅当IIS网站中存在HTTP绑定时,它才有效.当HTTP绑定不存在且仅存在HTTPS绑定时,我收到以下错误:

ServiceMetadataBehavior的HttpGetEnabled属性设置为true,HttpGetUrl属性是相对地址,但没有http基址.提供http基址或将HttpGetUrl设置为绝对地址.

我该如何解决这个问题?

谢谢.

Lad*_*nka 44

以这种方式修改配置:

<behaviors>
  <serviceBehaviors>
    <behavior> <!-- behavior can have name (must have name in WCF 3.x) -->
      <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>
Run Code Online (Sandbox Code Playgroud)