0

I want to send JSON data to my WCF Service, but in the Service there is my object always null. I have read so many articles but I can’t solve my problem.

[WebInvoke(UriTemplate = "/POST/PersonPost", Method = "POST",BodyStyle=WebMessageBodyStyle.WrappedRequest, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
 public Person InsertPerson(Person per)
 {   Debug.WriteLine("InsertPerson");
     if (per == null)
    {
       return new Person("2", "null");
    }

    Debug.WriteLine("POST:[PersonId = {0} PersonName = {1}]", per.Id, per.Name);
        return new Person("1", "InsertPerson");
  }

[DataContract]
    public class Person
    {

        public Person(string id, string name)
        {
            this.id = id;
            this.name = name;
        }
        [DataMember]
        public string Id { get; set; }
        [DataMember]            
        public string Name { get; set; }

        public override string ToString()
        {
            var json = JsonConvert.SerializeObject(this);
            return json.ToString();
        }
    }

and here my jQuery:

var person = {};
                person.Id = "abc123";
                person.Name = "aaaa";
                var per = {};
                per.per = person;

                var param = JSON.stringify(per);


                //param =   "{"per":{"Id":"abc123","Name":"aaaa"}}"

                $.support.cors = true;

                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    data: param,
                    dataType: "json",
                    processData: false,
                    crossDomain: true,
                    url: "http://localhost:59291/Person/POST/PersonPost",
                    success: function (data) {
                        alert("Post erfolgreich: ");

                    },
                    error: function (xhr, ajaxOptions, thrownError) {
                        alert("Fehler Post: Status " + xhr.status + " AntwortText " + xhr.responseText);
                    }
                });

What is there wrong? Why is my parameter per in the insertPerson method always null.