Why am I getting this WCF Error Message?

后端 未结 4 1249
长发绾君心
长发绾君心 2021-01-12 04:54

I am getting the error below when I call my WCF service. What am I missing here?

\'System.String[]\' with data contract name
\'ArrayOfstring:http://schemas.         


        
4条回答
  •  终归单人心
    2021-01-12 05:13

    In my case, after adding [Serializable] attribute to the MyEntity class. And then the issue came with serialization of the roles string array.

        [Serializable]
        [KnownType(typeof(string[]))]
        public class MyEntity
        {
           .........
           public string roles[]
           ......... 
        }
    

    [KnownType(typeof(string[]))] worked like magic!

提交回复
热议问题