将客户端证书添加到标准终结点
本文关键字:标准 结点 添加 客户端 证书 | 更新日期: 2023-09-27 18:30:49
我有一个 REST 服务,我想需要客户端证书。system.serviceModel
如下所示:
<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 name="TestService" helpEnabled="true" automaticFormatSelectionEnabled="true">
<security mode="Transport">
<transport clientCredentialType="Certificate" />
</security>
</standardEndpoint>
但这无济于事。启用客户端证书缺少什么?
标准绑定不支持该语法。你必须在webHttpBinding的绑定下定义它,并且不给它命名。这样它就适用于所有webHttoBinding。
<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>
配置
中有一个DNS选项卡? 类似的东西
<dns value="localhost" />
希望这个赫普斯