While converting an object to HttpContent , compilation succeeds. But while running I am getting below error.
Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies.
My Code snippet:
JArray jarray = (JArray)response; //response is of type var.
IEnumerable<MyModelClass> appResponse = jarray.ToObject<IEnumerable<MyModelClass>>();
HttpResponseMessage msg = new HttpResponseMessage();
msg.Content = new ObjectContent<IEnumerable<ConfigurationResponseDomainModel>>(appResponse, new JsonMediaTypeFormatter(), "application/json");
This line throws error. Assigning object to content. I am using Newtonsoft.Json(10.0.3). Any help will be appreciated.