Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/333.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# MessageSecurityException-WCF错误-从另一方接收到不安全或安全性不正确的错误_C#_Wcf_X509certificate_Wshttpbinding - Fatal编程技术网

C# MessageSecurityException-WCF错误-从另一方接收到不安全或安全性不正确的错误

C# MessageSecurityException-WCF错误-从另一方接收到不安全或安全性不正确的错误,c#,wcf,x509certificate,wshttpbinding,C#,Wcf,X509certificate,Wshttpbinding,我使用的是WCF服务和客户端,如果在同一台机器上有相同的证书(如果我有一个用于客户端的证书和一个用于服务器的证书),那么两者都可以很好地工作。 但是,如果我将服务部署到IIS(作为网站的一部分),我会得到一个模糊的错误,没有什么可搜索的,我真的不知道还能找什么。所有证书均已到位。 我收到“从另一方收到的未担保或未正确担保的故障” 服务器配置(ServiceModel部分) 客户端配置(ServiceModel部分)地址故意隐藏 <system.serviceModel>

我使用的是WCF服务和客户端,如果在同一台机器上有相同的证书(如果我有一个用于客户端的证书和一个用于服务器的证书),那么两者都可以很好地工作。 但是,如果我将服务部署到IIS(作为网站的一部分),我会得到一个模糊的错误,没有什么可搜索的,我真的不知道还能找什么。所有证书均已到位。 我收到“从另一方收到的未担保或未正确担保的故障”

服务器配置(ServiceModel部分)


客户端配置(ServiceModel部分)地址故意隐藏

 <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="wsHttpBinding_IIncomingDataService" maxBufferPoolSize="2147483647"
          maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
            maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="Message">
            <message clientCredentialType="Certificate" negotiateServiceCredential="false"
              algorithmSuite="Basic128" establishSecurityContext="false" />
          </security>
        </binding>        
      </wsHttpBinding>
    </bindings>
    <behaviors>
      <endpointBehaviors>
        <behavior name="CertificateServiceBehavior">
          <clientCredentials>
            <clientCertificate findValue="www.testserver.com"
                          storeLocation="LocalMachine"
                          storeName="TrustedPeople"
                          x509FindType="FindBySubjectName"/>
            <serviceCertificate >
              <defaultCertificate findValue="www.testserver.com"
                          storeLocation="LocalMachine"
                          storeName="TrustedPeople"
                          x509FindType="FindBySubjectName"/>
              <authentication certificateValidationMode="PeerOrChainTrust" />
            </serviceCertificate>
          </clientCredentials>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <client>
      <endpoint address="http://xxx.xxx.xxx.xxx/Services/IncomingDataService.svc"
        behaviorConfiguration="CertificateServiceBehavior" binding="wsHttpBinding"
        bindingConfiguration="wsHttpBinding_IIncomingDataService" contract="IncomingDataService.IIncomingDataService"
        name="wsHttpBinding_IIncomingDataService">
        <identity>
          <dns value="www.testserver.com" />
        </identity>
      </endpoint>
    </client>
  </system.serviceModel>

 <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="wsHttpBinding_IIncomingDataService" maxBufferPoolSize="2147483647"
          maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
            maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="Message">
            <message clientCredentialType="Certificate" negotiateServiceCredential="false"
              algorithmSuite="Basic128" establishSecurityContext="false" />
          </security>
        </binding>        
      </wsHttpBinding>
    </bindings>
    <behaviors>
      <endpointBehaviors>
        <behavior name="CertificateServiceBehavior">
          <clientCredentials>
            <clientCertificate findValue="www.testserver.com"
                          storeLocation="LocalMachine"
                          storeName="TrustedPeople"
                          x509FindType="FindBySubjectName"/>
            <serviceCertificate >
              <defaultCertificate findValue="www.testserver.com"
                          storeLocation="LocalMachine"
                          storeName="TrustedPeople"
                          x509FindType="FindBySubjectName"/>
              <authentication certificateValidationMode="PeerOrChainTrust" />
            </serviceCertificate>
          </clientCredentials>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <client>
      <endpoint address="http://xxx.xxx.xxx.xxx/Services/IncomingDataService.svc"
        behaviorConfiguration="CertificateServiceBehavior" binding="wsHttpBinding"
        bindingConfiguration="wsHttpBinding_IIncomingDataService" contract="IncomingDataService.IIncomingDataService"
        name="wsHttpBinding_IIncomingDataService">
        <identity>
          <dns value="www.testserver.com" />
        </identity>
      </endpoint>
    </client>
  </system.serviceModel>