WCF Web服务无法使用https

时间:2017-08-24 13:52:25

标签: c# wcf

我的网络服务在http上工作正常,但在https上它无效。 我认为web.config有一些错误,我也改变了https的web.config,但它对我不起作用。

<system.serviceModel >
<!--<serviceHostingEnvironment multipleSiteBindingsEnable ="true"></serviceHostingEnvironment>-->
<services>
  <service name="DriverSuvidhaAppService.Driversuvidhaservice" behaviorConfiguration="serviceBehave">
    <endpoint address="" behaviorConfiguration="webHttp" binding="webHttpBinding" contract="DriverSuvidhaAppService.IDriversuvidhaservice"/>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>   
    <host>
      <baseAddresses>
      </baseAddresses>
    </host>
  </service>
</services>
<bindings>
  <netTcpBinding>
    <binding name="TcpBindingConfiguration">
      <security mode="Transport">
        <transport clientCredentialType="None"/>
      </security>
    </binding>
  </netTcpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="serviceBehave">
      <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
  <endpointBehaviors>
    <behavior name="webHttp">
      <webHttp helpEnabled="true" automaticFormatSelectionEnabled="false" defaultBodyStyle="Bare" defaultOutgoingResponseFormat="Json"/>
    </behavior>
  </endpointBehaviors>
</behaviors>
<protocolMapping>
  <add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<!--<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>-->

1 个答案:

答案 0 :(得分:1)

按照Microsoft的此分步指南,使用SSL配置您的WCF -

How to: Configure an IIS-hosted WCF service with SSL