0
我是一個web服務的新手,所以請耐心等待。我有一個工作的本地主機上的WCF Restful服務。我想爲我的服務添加安全性。 我已經知道我可以將x.509證書添加到服務和jQuery客戶端。此外,我使用makecert.exe創建了以下this教程的證書。如何將x.509證書添加到Restful WCF服務?
我已經將證書添加到本教程中描述的web.config文件中,但服務人員並沒有向jquery客戶端請求證書。它只是迴應數據。我希望服務只有在從jquery客戶端獲得證書時才作出響應。
我可以看到MMC控制檯的可信任人員面板下列出的證書。
這是即使在web.config中添加證書我的服務回報數據托特他的客戶後,在服務
<system.serviceModel>
<services>
<service name="RestDemo.RestDemo" behaviorConfiguration="serviceBehavior">
<host>
<baseAddresses>
<add baseAddress="https://localhost/RestDemo/RestDemo.svc"/>
</baseAddresses>
</host>
<endpoint address="https://localhost/RestDemo/RestDemo.svc" binding="webHttpBinding" contract="RestDemo.IRestDemo" behaviorConfiguration="web">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex"
binding="mexHttpsBinding"
contract="RestDemo.IRestDemo" />
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="web">
<security mode="Transport">
<transport clientCredentialType="Certificate"/>
</security>
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="serviceBehavior">
<serviceCredentials>
<clientCertificate>
<authentication certificateValidationMode="PeerTrust"/>
</clientCertificate>
<serviceCertificate findValue="WCfServer"
storeLocation="CurrentUser"
storeName="My"
x509FindType="FindBySubjectName" />
</serviceCredentials>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="false" 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="web">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
的配置部分。 我在同一臺機器上同時運行服務和客戶端。
我在做什麼錯在這裏?