Link to home
Start Free TrialLog in
Avatar of HItesh Rana
HItesh Rana

asked on

WCF: The incoming message was signed with a token which was different from what used to encrypt the body. This was not expected.

I'm getting the following error:
The incoming message was signed with a token which was different from what used to encrypt the body.  This was not expected.

I'm thinking it has to do something with my app.config file
<system.serviceModel>
    
    <diagnostics>
      <messageLogging
           logEntireMessage="true"
           logMalformedMessages="false"
           logMessagesAtServiceLevel="true"
           logMessagesAtTransportLevel="false"
           maxMessagesToLog="3000"
           maxSizeOfMessageToLog="2000"/>
    </diagnostics>
    <client>
      <endpoint address="https://xxxxxx/ESARWS/CORETransactionService"
        behaviorConfiguration="endpointCredentialBehavior" binding="customBinding"
        bindingConfiguration="esar" contract="ESAR.CORETransaction"
        name="CoreSoapPort">
        <identity>
          <dns value="xxxxx" />
        </identity>
      </endpoint>
    </client>
   <behaviors>
     <endpointBehaviors>  
        <behavior name="endpointCredentialBehavior">
         
          <clientCredentials>  
            <clientCertificate findValue="xxxxx"
                               storeLocation="CurrentUser"
                               storeName="My"
                               x509FindType="FindBySubjectName"/>
            
           <serviceCertificate>
             <authentication certificateValidationMode="ChainTrust"/>
              <defaultCertificate findValue="xxxxxxxxx"
                               storeLocation="CurrentUser"
                               storeName="AddressBook"
                               x509FindType="FindBySubjectName" />   
           </serviceCertificate>
          </clientCredentials>  
        </behavior>  
     </endpointBehaviors>  
  </behaviors>
    <bindings>
     
       
      <customBinding>
        <binding name="esar" closeTimeout="00:01:00" openTimeout="00:01:00"
    receiveTimeout="00:10:00" sendTimeout="00:10:00">

          <security 
              defaultAlgorithmSuite="Basic128" 
              authenticationMode="MutualCertificate" 
              
               requireSecurityContextCancellation="false" 
              allowSerializedSigningTokenOnReply="true" 
              enableUnsecuredResponse="true" 
              allowInsecureTransport="false"
              requireDerivedKeys="false" 
              includeTimestamp="false" 
              securityHeaderLayout="Strict"
               messageProtectionOrder="SignBeforeEncrypt"
              messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10">
            <secureConversationBootstrap />
            <localClientSettings detectReplays="false"/>
          </security>
         
          <!--<mtomMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" 
            messageVersion="Soap12" writeEncoding="utf-8" maxBufferSize="2147483647">
           <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          </mtomMessageEncoding>-->
          
          <!--<mixedMessageEncoding  messageVersion="Soap12"/>-->

          <swaMessageEncoding innerMessageEncoding="textMessageEncoding" />
          <httpsTransport />
        </binding>
      </customBinding>
    </bindings>
    
   <extensions>
     <bindingElementExtensions>
        <!--<add name="mixedMessageEncoding" type="CustomEncoderProject.MyNewEncodingBindingExtensionElement, CustomEncoderProject"/>-->
     <add name="swaMessageEncoding"
             type="Microsoft.Austria.WcfHelpers.SoapWithAttachments.SwaMessageEncodingElement, Microsoft.Austria.WcfHelpers.SoapWithAttachments" />
      </bindingElementExtensions>
   </extensions>
    
</system.serviceModel> 

Open in new window

Avatar of Kyle Santos
Kyle Santos
Flag of United States of America image

Hi,

I am following up on your question.  Do you still need help?

If you solved the problem on your own, would you please post the solution here in case others have the same problem?

Regards,

Kyle Santos
Customer Relations
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.