2013-04-05 3 views
0

내 클라이언트 응용 프로그램이 로컬 IIS에서 호스팅되는 WCF 웹 서비스를 사용합니다. 이 웹 서비스는 이미지를 업로드하는 데 사용됩니다. 이미지 크기가 커지면 잘못된 요청 (400)이 발생합니다.WCF 클라이언트 요청이 잘못된 요청을 반환 함 (400)

클라이언트가 동적으로 웹 서비스 URL을 가져 오도록 구성되었습니다.

클라이언트 코드

string serviceUrl=GetUrl(); /* http://localhost:85/ImageUploaderService.svc */ 

TimeSpan timeOut = new TimeSpan(0, 30, 0); 

EndpointAddress endPoint = new EndpointAddress(serviceUrl);  


BasicHttpBinding binding = new BasicHttpBinding() 
{ 
    CloseTimeout = timeOut, 
    MaxReceivedMessageSize = 65536, 
    OpenTimeout = timeOut, 
    ReceiveTimeout = timeOut, 
    SendTimeout = timeOut, 
    MaxBufferSize = 65536, 
    MaxBufferPoolSize = 524288, 
    UseDefaultWebProxy = true, 
}; 

binding.ReaderQuotas = new System.Xml.XmlDictionaryReaderQuotas() 
{ 
    MaxArrayLength = 64000000, 
    MaxStringContentLength = 8192, 
    MaxDepth = 32, 
    MaxNameTableCharCount = 16384, 
    MaxBytesPerRead = 4096 
}; 

client = new ImageUploaderServiceClient(binding, endPoint); 

웹 서비스 측면 내가 뭐하는 거지 잘못된 무엇

<basicHttpBinding> 
    <binding maxBufferSize="64000000" maxReceivedMessageSize="64000000" maxBufferPoolSize="64000000"> 
     <readerQuotas maxDepth="64000000" maxStringContentLength="64000000" maxArrayLength="64000000" maxBytesPerRead="64000000" /> 
     <security mode="None"/> 
    </binding> 
    </basicHttpBinding> 

. 올바른 방법으로 안내해주세요.

답변

0

당신도 아마 클라이언트 측에서 MaxReceivedMessageSize을 증가해야합니다

BasicHttpBinding binding = new BasicHttpBinding() 
{ 
    MaxReceivedMessageSize = 64000000, 
    MaxBufferSize = 64000000, 
    MaxBufferPoolSize = 64000000, 
// ..... 
}; 
binding.ReaderQuotas = new System.Xml.XmlDictionaryReaderQuotas() 
{ 
    MaxArrayLength = 64000000, 
    MaxStringContentLength = 64000000, 
    MaxDepth = 64000000, 
    MaxBytesPerRead = 64000000 
}; 

는 예전에 같은 문제가 있었다 - 서버와 클라이언트 바인딩 구성이 동일해야합니다.

+0

설정을 변경했습니다. 하지만 여전히 400 오류가 발생합니다 : ( –

+0

당신도 ReaderQuotas의 설정을 변경 했습니까? 그들은 서버에서도 마찬가지 일 것입니다 ... –

+0

예. 이제 양쪽 모두 동일한 값을 가짐 –

관련 문제