2016-06-25 81 views
0

我是WCF的新手,我可以通過證書與我的WCF Web服務通信,但我無法獲得諸如Soap UI 5.0等非WCF應用程序的工作。 。我正在使用自簽名證書進行測試,但出現以下錯誤。WCF 4.5和Soap UI,帶有x509證書

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"> 
    <s:Header> 
     <a:Action s:mustUnderstand="1">http://www.w3.org/2005/08/addressing/soap/fault</a:Action> 
    </s:Header> 
    <s:Body> 
     <s:Fault> 
     <s:Code> 
      <s:Value>s:Sender</s:Value> 
      <s:Subcode> 
       <s:Value xmlns:a="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">a:InvalidSecurity</s:Value> 
      </s:Subcode> 
     </s:Code> 
     <s:Reason> 
      <s:Text xml:lang="en-US">An error occurred when verifying security for the message.</s:Text> 
    </s:Reason> 
    </s:Fault> 

我有一個基於這篇文章https://community.smartbear.com/t5/SoapUI-Open-Source/Help-with-Certificate/td-p/41385

上設置SOAP UI這是我的web配置

<system.serviceModel> 
    <diagnostics> 
     <messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" maxMessagesToLog="3000" maxSizeOfMessageToLog="2000" /> 
</diagnostics> 
<bindings> 
    <wsHttpBinding> 
    <binding name="wsHttpEndpointBinding"> 
     <security mode="TransportWithMessageCredential"> 
     <message clientCredentialType="Certificate" negotiateServiceCredential="false" 
      algorithmSuite="Default" establishSecurityContext="false" /> 
     </security> 
    </binding> 
    <binding name="wsHttpEndpointBinding_https" messageEncoding="Text"> 
     <security mode="Transport"> 
     <transport clientCredentialType="None" proxyCredentialType="None" /> 
     <message clientCredentialType="None" negotiateServiceCredential="false" 
      algorithmSuite="Default" establishSecurityContext="false" /> 
     </security> 
    </binding> 
    </wsHttpBinding> 
</bindings> 
<services> 
    <service behaviorConfiguration="ServiceBehaviors" name="OneService4.OneServiceWCF"> 
    <endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsHttpEndpointBinding" name="OneService" contract="OneService4.IOneServiceWCF" /> 
    <endpoint address="m" binding="wsHttpBinding" bindingConfiguration="wsHttpEndpointBinding_https" name="OneServiceHttps" contract="OneService4.IOneServiceWCF" /> 
    <!--<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
    <endpoint address="mex2" binding="mexHttpsBinding" contract="IMetadataExchange" />--> 
    </service> 
</services> 
<behaviors> 
    <serviceBehaviors> 
    <behavior name="ServiceBehaviors" > 
     <serviceSecurityAudit auditLogLocation="Application" serviceAuthorizationAuditLevel="Failure" messageAuthenticationAuditLevel="Failure" suppressAuditFailure="true" /> 
     <!-- To avoid disclosing metadata information, set the values below to false before deployment --> 
     <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" /> 
     <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
     <serviceDebug includeExceptionDetailInFaults="true" /> 
     <useRequestHeadersForMetadataAddress> 
     <defaultPorts> 
      <add scheme="https" port="443" /> 
      <add scheme="http" port="80" /> 
     </defaultPorts> 
     </useRequestHeadersForMetadataAddress> 
     <serviceCredentials> 
      <serviceCertificate findValue="WCFCert" x509FindType="FindBySubjectName" storeLocation="CurrentUser" storeName="TrustedPeople" /> 
     <clientCertificate> 
      <authentication certificateValidationMode="None" revocationMode="NoCheck" /> 
     </clientCertificate> 
     </serviceCredentials> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> 

回答

0

根據你的web.config中,服務安全審計已啓用。您可以在EventLog中獲得更多詳細信息。 (打開事件查看器,然後打開相應的應用程序文件夾,找出發生安全錯誤的原因)。然後,您可以排除實際導致安全錯誤的問題。

可能是由於您的安全綁定和SOAPUI哈希算法之間的不匹配造成的。