Search code examples
wcfwcf-client

WCF NetDispatcherFaultExcption when passing byte array from Service to Client


I am trying to pass a file (byte array) from the service to the client. I receive "the formatter threw an exception while trying to deserialize Expecting state 'Element'.. Encountered 'Text' with name '', namespace ''" error. Any ideas on how to fix it will be much appreciated.

Thanks,

Raja


Solution

  • After breaking my head for 4 freaking hours I found the answer to the problem. It is the WSSF(Web service software factory) who is the culprit. While generating the data contract it had generated it as List for file instead of byte[]. Changed the List to byte[] in my proxy and everything works well now. Hope this helps someone.

    Thanks,

    Raja