У меня есть веб-приложение Aspx, в котором у меня есть WebMethod, который я вызываю из сообщения Ajax, проблема в том, что при выполнении вызова он выдает мне:
"Could not load file or assembly 'Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"
Я уже пытаюсь удалить и переустановить слепок Newtonsoft.Json, но он не работает, у меня версия 10.0.2, так что я не знаю, почему в цикле для версии 11.0, вот что У меня есть на моем web.config:
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed"/>
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0"/>
А это мой вызов ajax:
$.ajax({
type: "POST",
url: "call.aspx/getToken",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
data = JSON.parse(data.d);
apiKey = data[0].apiKey;
sessionId = data[0].sessionId;
token = data[0].token;
initializeSession();
}
});
А это мой веб-метод:
[System.Web.Services.WebMethod(EnableSession = true)]
public static string getToken()
{
//some code
return JsonConvert.SerializeObject(ListVar);
}
Почему это может быть эта ошибка?