나는 내 로컬 컴퓨터에 webapi에게HttpClient를를 응답 메시지 크기
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;
}
이 없거나, 데이터에게 내가 원하는 방식으로 검색하는 것 같다. 나는 MaxResponseContentBufferSize을 설정 해달라고하지만 우리의 빌드 환경에, 나는이 오류가 발생합니다 : 가 구성된 최대 버퍼 크기보다 버퍼에 더 많은 바이트를 쓸 수 없습니다 : 구글에보고 한 후 65536
, 나는 MaxResponseContentBufferSize을하기로 결정 임의의 256000 값으로 설정합니다. 내가 지금 어떻게 해야할지 아무 생각이 없다 '무효 System.Net.Http.HttpClient.set_MaxResponseContentBufferSize (INT64)
: 발견되지 방법 :이 내 로컬 컴퓨터에서 작동하더라도, 빌드 상자에 나는이 오류가 발생합니다.
이 코드는 무엇입니까? ASP.NET 응용 프로그램 또는 다른 응용 프로그램의 경우? – tugberk
예, asp.net 웹 API 코드입니다. 우리는 아난드의 게시물에 대한 제 의견에 따라 그것을 해결했습니다. –