2012-04-10 117 views
0

我有一個REST服務,我想要求客戶端證書。該system.serviceModel如下所示:將客戶端證書添加到standardEndpoint?

<system.serviceModel> 
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/> 
    <standardEndpoints> 
     <webHttpEndpoint> 
     <!-- 
      Configure the WCF REST service base address via the global.asax.cs file and the default endpoint 
      via the attributes on the <standardEndpoint> element below 
     --> 
     <standardEndpoint name="TestService" helpEnabled="true" automaticFormatSelectionEnabled="true"/> 
     </webHttpEndpoint> 
    </standardEndpoints> 
    </system.serviceModel> 

我試圖修改standardEndpoint是:

<standardEndpoint name="TestService" helpEnabled="true" automaticFormatSelectionEnabled="true"> 
    <security mode="Transport"> 
    <transport clientCredentialType="Certificate" /> 
    </security> 
</standardEndpoint> 

但是這並沒有幫助。我缺少什麼來啓用客戶端證書?

+0

您是否在IIS上映射了相同的設置? – Rajesh 2012-04-10 14:59:18

回答

2

標準綁定不支持這種語法。你必須在webHttpBinding下的綁定下定義它,並且不給它命名。這種方式適用於所有webHttoBinding(s)。

<system.serviceModel> 
     <bindings> 
      <webHttpBinding> 
       <binding> 
        <security mode="Transport"> 
         <transport clientCredentialType="Certificate" /> 
        </security> 
       </binding> 
      </webHttpBinding> 
     </bindings> 
     <standardEndpoints> 
      <webHttpEndpoint> 
       <standardEndpoint name="TestService" helpEnabled="true" automaticFormatSelectionEnabled="true"/> 
      </webHttpEndpoint> 
     </standardEndpoints> 
    </system.serviceModel> 
0

在配置中有一個DNS選項卡?像

<dns value="localhost" /> 

希望這個hepls