title: HttpClient Response Message Size
body: <p>I have a webapi</p>
  
  <pre><code>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&lt;SearchProviderCommandResult&gt;(output.Content.ReadAsStringAsync().Result);
  
    return searchResult;
  }
  </code></pre>
  
  <p>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.</p>
  
  <p>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)</p>
  
  <p>I have no idea what to do now.</p>