2

我正在尝试访问 WCF 服务端点。但是,每当我尝试访问该服务时,我都会在服务器上不断收到上述异常(当我检查日志时)。
该服务基本上具有相互证书行为。它列出了一个客户端证书和一个服务证书。此外,它在其 web.conf 的 endpoint\identity 部分下指定了一个 userPrincipleName... 类似设置的配置文件示例如下所示...

        <endpoint address="<nicelyAddressEndpoint>"
            binding="netTcpBinding" bindingConfiguration="customTcpBinding"
            contract="<service>" name="<smartSoundingCamelCasedServiceName>">
            <identity>
                <userPrincipalName value="<example>@yourMother.net" />
            </identity>
        </endpoint>

将是我描述的端点。

  <service name="<NiceServiceName>" behaviorConfiguration="MutualCertificateBehavior">
    <endpoint address="" binding="customBinding" bindingConfiguration="CustomMCBinding" contract="IServiceContractThatIsntWrittenPoorley"/>
  </service>

    <behavior name="MutualCertificateBehavior">
      <serviceDebug includeExceptionDetailInFaults="true"/>
      <serviceMetadata httpGetEnabled="true" />
      <serviceCredentials>
        <clientCertificate>
          <authentication certificateValidationMode="PeerOrChainTrust" revocationMode="NoCheck" includeWindowsGroups="false"/>
          <certificate findValue="<CertName>" storeLocation="LocalMachine" storeName="Root" x509FindType="FindBySubjectName" />
        </clientCertificate>
        <serviceCertificate findValue="<ServiceCert>" storeLocation="LocalMachine" storeName="Root" x509FindType="FindBySubjectName" />
      </serviceCredentials>
    </behavior>

这就是服务和行为。

我正在尽我所能尝试从这件事中获取数据。我遇到了一个症结,我不确定是不是因为我走错了路,还是因为我已经很接近了,我只需要克服一点小麻烦。在我的客户端 web.config 中,我类似地设置了端点行为......

      <behavior name="ClientCertificateBehvior">
        <clientCredentials>              
          <clientCertificate findValue="<XXX>"
                             storeLocation="LocalMachine"
                             storeName="My"
                             x509FindType="FindBySubjectName"/>
          <serviceCertificate>
            <authentication certificateValidationMode="PeerOrChainTrust" revocationMode="NoCheck" />
            <defaultCertificate findValue="<XXX>" storeLocation="LocalMachine" storeName="Root" x509FindType="FindBySubjectName" />
          </serviceCertificate>
        </clientCredentials>
      </behavior>

这是我的终点...

        <endpoint address="xxx.xxx.xxx"
            behaviorConfiguration="ClientCertificateBehvior" binding="customBinding"
            bindingConfiguration="CustomBinding_IVPOService" contract="VPOServiceEndPoint.IVPOService"
            name="CustomBinding_IVPOService">
            <identity>
                <dns value="xxx" />
                <userPrincipalName value="yyy@xxx.net" />
            </identity>
        </endpoint>

现在,每当我尝试使用此服务时,我都会收到此异常...

The identity check failed for the outgoing message. The expected identity is 'identity(http://schemas.xmlsoap.org/ws/2005/05/identity/right/possessproperty: http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn)' for the 'xxxxxx' target endpoint.

我会注意到,我的本地计算机上列出了相应商店中的证书,并且我已向该证书授予了相应的写入权限。我到了这样的地步,我意识到我在这里给自己制造了更多麻烦,我试图找出正确的做法,而不是把东西扔在墙上,看看有什么东西会粘住。我错过了什么步骤?从 MutualCertificate 安全服务接收数据的最佳方式是什么?我怎样才能最好地获得正确的用户原则名称?我认为这将是服务 web.config 中列出的内容?我是否以正确的方式解决这个问题?我是在接近还是只是为自己制造更大的混乱?

4

0 回答 0