Nithesh Narayanan
Nithesh Narayanan

Reputation: 11775

Message could not be Processed exception in WCF

Hi am trying to call a WCF service in my windows application

I added the service reference to my Project but while executing the following error occures:

This is most likely because the action 'http://tempuri.org/IUser/SaveUser' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding.

I tried with increasing the Receive timeout on the service endpoint's binding. But the same exception is there.

Here is the config file on client

<configuration>
    <system.serviceModel>
        <bindings>
            <wsHttpBinding>
                <binding name="WSHttpBinding_IUser" closeTimeout="00:01:00" openTimeout="00:01:00"
                    receiveTimeout="00:30:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
                    transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                    allowCookies="false">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <reliableSession ordered="true" inactivityTimeout="00:45:00"
                        enabled="false" />
                  <security mode="None">
                    <transport clientCredentialType="None" />
                  </security>

                </binding>
            </wsHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://t2.ipixsolutions.net/Service.svc" binding="wsHttpBinding"
                bindingConfiguration="WSHttpBinding_IUser" contract="ServiceReference1.IUser"
                name="WSHttpBinding_IUser">
                <identity>
                    <dns value="localhost" />
                </identity>
            </endpoint>
        </client>
    </system.serviceModel>
</configuration>

Config at server

<system.serviceModel>
        <services>
      <service behaviorConfiguration="ServiceBehavior" name="WCFLibrary.Users">
                <endpoint address="" binding="wsHttpBinding" contract="WCFLibrary.IUser">
          <identity>
                        <dns value="localhost"/>
                    </identity>
                </endpoint>
                <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
            </service>
        </services>
        <behaviors>
            <serviceBehaviors>
                <behavior name="ServiceBehavior">
                    <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
                    <serviceMetadata httpGetEnabled="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="false"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>
    </system.serviceModel>

Upvotes: 3

Views: 10364

Answers (3)

Eternal21
Eternal21

Reputation: 4684

Maybe this will help someone. I had the same error pop up on a customer's PC. The application would fail to sign into our server 9 out of 10 times. This is for a WCF client that used to work perfectly fine. The culprit turned out to be an adware application that he must've accidentally installed with another software. It would inject adds into http stream, which was screwing up our communication. The adware in question was RocketTab (http://malwaretips.com/blogs/rockettab-virus-removal/).

The way we figured it out is by noticing that the problem didn't happen if we used a different Windows user on his PC. We then used Task Manager to close processes on his PC that didn't look essential, and found that when we closed client.exe process our application started working. That led us to RocketTab (their executable was client.exe).

Upvotes: 0

Joseph Quansah
Joseph Quansah

Reputation: 1

I had the same issue and modified the security element with the following

                <security mode="Message">
                    <transport clientCredentialType="Ntlm" proxyCredentialType="Ntlm"
                        realm=""  />
                    <message clientCredentialType="Windows" algorithmSuite="Default" />
                </security>
  1. I modified the Security mode from "None" to "Message".
  2. I modified the ClientCredentialType for the Transport from "None" to "Ntlm" = clientCredentialType="Ntlm"
  3. I modified the proxyCredentialType for the Transport from "None" to "Ntlm" = proxyCredentialType ="Ntlm"

Upvotes: 0

Sebastian K
Sebastian K

Reputation: 6403

Heh, I am getting this very same exception, in my case this is because of this setting:

<security mode="None">

If I change it to:

<security mode="Message">

It works fine. I guess it must be picked up from defaults, because I do not set it on server side.

Upvotes: 2

Related Questions