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>
的配置部分。 我在同一台机器上同时运行服务和客户端。
我在做什么错在这里?