JG Vimalan's Blog

It is all about coding!

System.ServiceModel.Dispatcher.NetDispatcherFaultException: The formatter threw an exception while trying to deserialize the message

This exception is thrown when your client application receives a large data from WCF service and it is not able to deserialize them. So, you have to set the DataContractSerializer property in the EndPointBehaviour in your client application. To do that, you can edit your web.config file using WCF Service Configuration Editor (available in the VS -> tools menu)

Add the endpointbehaviour and set its name under the client endpoint tag. Once you do that, your web.config will look like,

<system.serviceModel>
        <behaviors>
            <endpointBehaviors>
                <behavior name=”NewBehavior”>
                    <dataContractSerializer maxItemsInObjectGraph=”2147483647″ />
                </behavior>
            </endpointBehaviors>
    ….

    ….

</bindings>
        <client>
            <endpoint address=”http://mySystem/WCFService/Manager.svc” behaviorConfiguration=”NewBehavior”
                binding=”basicHttpBinding” bindingConfiguration=”basicEndPoint”
                contract=”MyServiceReference.IManager” name=”basicEndPoint” />
        </client>

Advertisements

October 20, 2010 - Posted by | WCF

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: