使用https保护wcf

时间:2011-11-30 07:57:59

标签: wcf https

我在IIS 6.0中使用https保护的虚拟目录下托管了一个WCF .svc文件。通过我的浏览器请求wsdl时出现http 400错误。这是我的web.config的一大块:

<system.serviceModel>
<bindings>  
    <basicHttpBinding>
          <binding name="TransportSecurity">
              <security mode="TransportWithMessageCredential">
                  <message clientCredentialType="Certificate"/>
              </security>
          </binding>     
  </basicHttpBinding>     
</bindings>
<services>
  <service name="AuthWorkStation_Extranet.App_Code.AwsService" behaviorConfiguration="ServiceBehavior">       
    <endpoint name="" address="https://extlpo01.srr.fr/Sphinx/Service.svc" binding="basicHttpBinding" bindingConfiguration="TransportSecurity" contract="AuthWorkStation_Extranet.App_Code.IAwsService" />
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="ServiceBehavior">
      <serviceCredentials>
         <serviceCertificate storeName="Root" findValue="CA_SRR_DISTRIB" x509FindType="FindBySubjectName" />
      </serviceCredentials> 
      <serviceMetadata httpsGetEnabled="True" />
      <serviceDebug includeExceptionDetailInFaults="True"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

任何人都知道我的设置有什么问题?

1 个答案:

答案 0 :(得分:0)

如果您只想要HTTPS,则需要更新web.config。更改以下内容:

<bindings>   
  <basicHttpBinding> 
    <binding name="TransportSecurity"> 
      <security mode="TransportWithMessageCredential"> 
        <message clientCredentialType="Certificate"/> 
      </security> 
    </binding>      
  </basicHttpBinding>      
</bindings>

要:

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