System.ServiceModel:对SSPI的调用失败,目标主体名称不正确

时间:2013-01-07 17:36:32

标签: wcf x509certificate userprincipal upn

我正在尝试点击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安全服务接收数据的最佳方法是什么?我怎样才能最好地获得正确的userPrinciplename?我认为这将是servie web.config中列出的内容?我是否以正确的方式解决这个问题?我是靠近还是为自己制造更大的混乱?

0 个答案:

没有答案