Search code examples
stringwcfwcf-binding

WCF Comunication Exception when passing string array


I have a wcf service and i want to pass a string[] through it. I am receiving the below error. Can someone point me in the right direction ?

The error :

There was an error while trying to serialize parameter http://services.csssoftware.com/2.0/ComFacades:arParams. The InnerException message was 'Type 'System.String[]' with data contract name 'ArrayOfstring:http://schemas.microsoft.com/2003/10/Serialization/Arrays' is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.'. Please see InnerException for more details.

If you need more data plese let me know and i will edit the question.


Solution

  • For others who get to the same error, the fix was to add :[ServiceKnownType(typeof(string[]))] in my interface class.

    For more information about this problem you can read : HERE