0

我有一个需要客户端证书的 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修改为:

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

但这并没有帮助。启用客户端证书我缺少什么?

4

2 回答 2

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>
于 2012-05-08T02:33:54.910 回答
0

在配置中有一个 DNS 选项卡吗?就像是

<dns value="localhost" /> 

希望这有帮助

于 2012-04-10T15:45:18.973 回答