前端 是HTML,通过AJAX异步调用,
其中masterString是将JSON格式的数组转换成string,(使用json2.js与自己写的jsonToString)均有问题。
$.ajax({
url: "../Services/Service" + handletype + ".ashx",
type: "post",
dataType: "text",
data: "add=fl&result=" + masterString + "&encoded=" + encodeURIComponent(masterString),
async: true,
success: function (data) {}
});
后台是.NET写的ashx的generic handler,后台捕获数据时发现:
约5000次请求中会有1-2次数据异常,
key:add
value:fl
key:result
value:{"MasterID":"7","UserOpenID":"","QAList":[{"Q":"733","A":"2072"},{"Q":"734","A":"2076"},{"Q":"735","A":"2079"},{"Q":"736","A":"2082"},{"Q":"737","A":"2085"},{"Q":"738","A":"2088"},{"Q":"739","A":"2091"},{"Q":"740","A":"2094"},{"Q":"741","A":"2097"},{"Q":"742","A":"2099"},{"Q":"743","A":"2103"},{"Q":"744","{"Q":"747","A":"2114"},{"Q":"748","A":"2119"},{"Q":"749","A":"2122"},{"Q":"750","A":"2123"},{"Q":"751","A":"2128"},{"Q":"752","A":"2129"},{"Q":"753","A":"2134"},{"Q":"754","A":"2137"},{"Q":"755","A":"2138"},{"Q":"756","A":"2142"},{"Q":"757","A":"2144"},{"Q":"758","A":"2148"},{"Q":"759","A":"2150"},{"Q":"760","A":"2151"},{"Q":"761","A":"2154"},{"Q":"762","A":"2158"},{"Q":"763","A":"2163"},{"Q":"764","A":"2168"},{"Q":"765","A":"2173"}]}
key:encoded
value:{"MasterID":"7","UserOpenID":"","QAList":[{"Q":"733","A":"2072"},{"Q":"734","A":"2076"},{"Q":"735","A":"2079"},{"Q":"736","A":"2082"},{"Q":"737","A":"2085"},{"Q":"738","A":"2088"},{"Q":"739","A":"2091"},{"Q":"740","A":"2094"},{"Q":"741","A":"2097"},{"Q":"742","A":"2099"},{"Q":"743","A":"2103"},{"Q":"744","A":"2106"},{"Q":"745","A":"2109"},{"Q":"746","A":"2112"},{"Q":"747","A":"2114"},{"Q":"748","A":"2119"},{"Q":"749","A":"2122"},{"Q":"750","A":"2123"},{"Q":"751","A":"2128"},{"Q":"752","A":"2129"},{"Q":"753","A":"2134"},{"Q":"754","A":"2137"},{"Q":"755","A":"2138"},{"Q":"756","A":"2142"},{"Q":"757","A":"2144"},{"Q":"758","A":"2148"},{"Q":"759","A":"2150"},{"Q":"760","A":"2151"},{"Q":"761","A":"2154"},{"Q":"762","A":"2158"},{"Q":"763","A":"2163"},{"Q":"764","A":":"2163"},{"Q":"764","A":"2168"},{"Q":"765","A":"2173"}]}
发现:
不进行encode在Q744处出现异常(异常位置随机,每次都不一样。){"Q":"744","{"Q":"747","A":"2114"},encode部分在764处异常,"Q": "764","A": ":"2163"},
求各位大神帮忙支招。