I've searched all the existing question/answers concerning the error in the subject but the behaviour let me thing is not something wrong at the code rather on the machine instead.
I have the local dev machine on Windows 10 in which the deserialization works perfectly. Once I publish on Server 2012 it blows up. I used 3 version of the code to try to force a resolution, I can get different error messages but the result is the same, on production when try to deserialize blows up
I am using .NET framework 4 and C# with NewtonJson to handle JSON calls.
What I am unable to find if someone had odd behaviour on different deploy.
below the snippet:
foreach(var s in ids) {
i++;
string _endpoint = sbc_url + s;
Uri _uri = new Uri(_endpoint);
WebClient wcClient = new WebClient();
wcClient.BaseAddress = _endpoint;
wcClient.Headers.Add("contentType: 'application/json; charset=utf-8'");
wcClient.Headers.Add("dataType: 'json'");
var response = wcClient.DownloadString(_endpoint);
try {
var jss = new JavaScriptSerializer();
var dict = jss.Deserialize <Dictionary<string, dynamic>> (response); // BLOWS UP HERE
ws_ret r = new ws_ret();
foreach(var tt in dict["result"]) {
r.result.Add(tt);
}
if (r.result != null)
numeri.result.AddRange(r.result);
} catch (Exception ex) {
}
}