I have a webapi
public ISearchProviderCommandResult ExecuteCommand(ISearchProviderCommand searchCommand)
{
//serialize the object before sending it in
JavaScriptSerializer serializer = new JavaScriptSerializer();
string jsonInput = serializer.Serialize(searchCommand);
HttpClient httpClient = new HttpClient() { BaseAddress = new Uri(ServiceUrl), MaxResponseContentBufferSize = 256000 };
StringContent content = new StringContent(jsonInput, Encoding.UTF8, "application/json");
HttpResponseMessage output = httpClient.PostAsync(ServiceUrl, content).Result;
//deserialize the output of the webapi call
SearchProviderCommandResult searchResult = serializer.Deserialize<SearchProviderCommandResult>(output.Content.ReadAsStringAsync().Result);
return searchResult;
}
on my local machine whether I set the MaxResponseContentBufferSize or not, it seems to retrieve data the way I want it. However on our build environment, If I dont set the MaxResponseContentBufferSize , I get this error:
Cannot write more bytes to the buffer than the configured maximum buffer size: 65536.
After looking on google, I decided to set the MaxResponseContentBufferSize to an arbitrary 256000 value. Even though this works on my local machine, on the build box I get this error:
Method not found: ‘Void System.Net.Http.HttpClient.set_MaxResponseContentBufferSize(Int64)
I have no idea what to do now.
Look at this thread on forums.asp.net. It seems there is some issue with .net 4.5 beta version on your build environment. There is surely a mismatch of dlls on your local and your build environment