2015-10-20 79 views
0

我正在尝试使用SOAP UI来调用WCF服务并获取以下错误;不知道什么是错的。
错误:安全处理器无法在消息中找到安全标头。这可能是因为该消息是不安全的错误,或者是因为通信方之间存在绑定不匹配。如果服务配置了安全性并且客户端没有使用安全性,则会发生这种情况。WCF - 错误安全处理器无法在邮件中找到安全标头

web.config 
      <system.serviceModel> 
      <diagnostics performanceCounters="All"> 
       <messageLogging logMalformedMessages="true" logMessagesAtTransportLevel="true"/> 
       <endToEndTracing propagateActivity="true" messageFlowTracing="true"/> 
      </diagnostics> 
      <behaviors> 
       <serviceBehaviors> 
       <behavior name="DefaultBehavior"> 
        <!--<serviceThrottling maxConcurrentCalls="100" maxConcurrentInstances="200" maxConcurrentSessions="100"/>--> 
        <serviceAuthorization principalPermissionMode="Always"/> 
        <serviceCredentials useIdentityConfiguration="true"> 
        <serviceCertificate findValue="localhost" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName"/> 
        <issuedTokenAuthentication audienceUriMode="BearerKeyOnly" certificateValidationMode="PeerOrChainTrust" revocationMode="NoCheck" 
            trustedStoreLocation="LocalMachine" allowUntrustedRsaIssuers="false"></issuedTokenAuthentication> 
        </serviceCredentials> 
        <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/> 
        <serviceDebug includeExceptionDetailInFaults="false"/> 
       </behavior> 
       </serviceBehaviors> 
      </behaviors> 
      <serviceHostingEnvironment aspNetCompatibilityEnabled="false"/> 
      <bindings> 
       <ws2007FederationHttpBinding> 
       <binding name="wsFedBinding" receiveTimeout="00:10:00" sendTimeout="00:10:00" openTimeout="00:10:00" closeTimeout="00:10:00" 
          maxReceivedMessageSize="262144" maxBufferPoolSize="262144"> 
        <readerQuotas maxArrayLength="16384" maxDepth="32" maxStringContentLength="262144" maxBytesPerRead="4096" maxNameTableCharCount="16384"/> 
        <security mode="TransportWithMessageCredential"> 
        <message issuedKeyType="BearerKey" issuedTokenType="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0" 
            negotiateServiceCredential="false" establishSecurityContext="false"/> 
        </security> 
        <security mode="None"> 
        <!--<message negotiateServiceCredential="true"></message>--> 
        </security> 
       </binding> 
       </ws2007FederationHttpBinding> 
       <wsHttpBinding> 
       <binding name="wsHttpClientServiceBinding" receiveTimeout="00:10:00" sendTimeout="00:10:00" openTimeout="00:10:00" closeTimeout="00:10:00" 
          maxReceivedMessageSize="262144" maxBufferPoolSize="262144"> 
        <readerQuotas maxArrayLength="16384" maxDepth="32" maxStringContentLength="262144" maxBytesPerRead="4096" maxNameTableCharCount="16384"/> 
        <security mode="Transport"> 
        <transport clientCredentialType="None"></transport> 
        </security> 
       </binding> 
       </wsHttpBinding> 
      </bindings> 
      <services> 
       <service name="XXX.Service" behaviorConfiguration="DefaultBehavior"> 
       <host> 
        <baseAddresses> 
        <add baseAddress="https://ws40022517..intranet/XXXX.Service/" /> 
        </baseAddresses> 
       </host> 
       <endpoint address="" binding="ws2007FederationHttpBinding" bindingConfiguration="wsFedBinding" 
          contract="XXX.Contract.Vault.ServiceContract.IVaultService"/> 
       </service> 
      </services> 

      </system.serviceModel> 
      <system.webServer> 
      <modules runAllManagedModulesForAllRequests="true"/> 

      <directoryBrowse enabled="false"/> 
      <httpProtocol> 
       <customHeaders> 
       <add name="X-Content-Type-Options" value="nosniff"/> 
       </customHeaders> 
      </httpProtocol> 
      </system.webServer> 
      <runtime> 
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
       <dependentAssembly> 
       <assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral"/> 
       <bindingRedirect oldVersion="0.0.0.0-3.3.1.4000" newVersion="3.3.1.4000"/> 
       </dependentAssembly> 
      </assemblyBinding> 
      </runtime> 
      <system.identityModel> 
      <identityConfiguration saveBootstrapContext="true"> 
       <issuerNameRegistry type="System.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
       <trustedIssuers> 
        <add thumbprint="XXXXC" name="SignCertificate"/> 
       </trustedIssuers> 
       </issuerNameRegistry> 
       <securityTokenHandlers> 
       <remove type="System.IdentityModel.Tokens.Saml2SecurityTokenHandler, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> 
       <add type="XXXX.OcdSaml2SecurityTokenHandler, XXX.WCFExtension"/> 
       </securityTokenHandlers> 
       <claimsAuthenticationManager type="XXXX.Security.SoapClaimsAuthenticationManager, XXXX"/> 
      </identityConfiguration> 
      </system.identityModel> 

If I comment the TranportwithMessagesecurity and add just transport and none then it shows that channel endpoint not found. 

回答

0

添加以下代码在webconfig和尝试:

<security enableUnsecuredResponse="true" 
     authenticationMode="MutualCertificateDuplex" 
     defaultAlgorithmSuite="TripleDesRsa15" 
     includeTimestamp="false" 
     messageSecurityVersion="Default" > 
    </security> 
+0

本应在其下部分被添加? – user3264937

+0

system.webserver – Vinoth

+0

它不能在system.webserver下工作;标签没有被识别。配置错误 – user3264937