The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter
I am creating an array in my jquery code then am calling stringify to make it as json data and then am calling a service that receives an object , but unfortunately I am getting this error , and this error is caused by the fact that my object consists of array properties , I have the same code and it's all working fine when my object is only strings and numbers....this is a part of my object
[Serializable]
[DataContract]
public class ImagesEditInfo
{
[DataMember(IsRequired=true)]
public int[] Image开发者_StackOverflow中文版Ids
{
get;
set;
}
}
can anyone help please?
What does your service look like and could you provide some sample requests?
I approximately use this for service calls
$.ajax({
type: 'POST',
url: serviceURL,
contentType: 'application/json',
data: JSON.stringify({ serviceParameterName: javascriptObject }),
success: successFunction,
dataType: 'json'
});
in your case your service method would have to be something like this:
[OperationContract]
[WebInvoke(ResponseFormat = WebMessageFormat.Json, UriTemplate = serviceURL, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
public string methodName(ImagesEditInfo serviceParameterName) { }
精彩评论