在IIS Express中,WCF服务无法使用https

时间:2015-01-02 07:02:56

标签: wcf

我在我的解决方案中使用WCF服务。它适用于http localhost。安装证书后,它无法使用https localhost。这是配置,

<system.serviceModel>
    <bindings>
    <customBinding>
        <binding name="RawReceiveCapable">
          <webMessageEncoding webContentTypeMapperType="SmsService.RawContentTypeMapper, SmsService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
          <httpsTransport authenticationScheme="Basic"  manualAddressing="true" maxReceivedMessageSize="524288000" transferMode="Streamed" />
        </binding>
    </customBinding>
</bindings>
<behaviors>
    <serviceBehaviors>
    <behavior name="ServiceBehavior">
      <serviceMetadata httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
  <endpointBehaviors>
    <behavior name="EndpBehavior">
      <webHttp />
    </behavior>
  </endpointBehaviors>
</behaviors>
<services>
  <service behaviorConfiguration="ServiceBehavior" name="TR_Registry.Service1">
    <!--<endpoint address="" binding="webHttpBinding"  contract="TR_Registry.IService1" behaviorConfiguration="EndpBehavior" />-->
  <!--<endpoint address="" binding="basicHttpBinding" contract="TR_Registry.IService1"></endpoint>-->
  <endpoint address=""
              binding="basicHttpBinding"
              bindingConfiguration="secureHttpBinding"
              contract="TR_Registry.IService1"/>

    <endpoint address="mex"
              binding="mexHttpsBinding"
              contract="IMetadataExchange" />
  </service>
</services>

  

2 个答案:

答案 0 :(得分:0)

尝试使用设置basicHttpBinding详细信息并使用传输级别安全性

<bindings>
  <basicHttpBinding>
    <binding name="secureHttpBinding">
      <security mode="Transport">
        <transport clientCredentialType="None"/>
      </security>
    </binding>
  </basicHttpBinding>      
</bindings>

答案 1 :(得分:0)

添加以下绑定

<bindings>
  <basicHttpBinding>
    <binding name="secureHttpBinding">
      <security mode="Transport">
        <transport clientCredentialType="None"/>
      </security>
    </binding>
  </basicHttpBinding>
</bindings>

指定您的服务和服务端点

<service name="TR_Registry.Service1">
    <endpoint address=""
              binding="basicHttpBinding"
              bindingConfiguration="secureHttpBinding"
              contract="TR_Registry.IService1"/>

    <endpoint address="mex"
              binding="mexHttpsBinding"
              contract="IMetadataExchange" />
</service>

有关详细信息,请点击此链接http://msdn.microsoft.com/en-us/library/hh556232%28v=vs.110%29.aspx