0
我的客戶端應用程序使用託管在本地IIS中的WCF Web服務。此Web服務用於上傳圖像。一旦圖像尺寸變大,它會提出錯誤的請求(400)。WCF客戶端請求返回錯誤請求(400)
客戶端被配置爲動態獲取Web服務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);
Web服務端
<basicHttpBinding>
<binding maxBufferSize="64000000" maxReceivedMessageSize="64000000" maxBufferPoolSize="64000000">
<readerQuotas maxDepth="64000000" maxStringContentLength="64000000" maxArrayLength="64000000" maxBytesPerRead="64000000" />
<security mode="None"/>
</binding>
</basicHttpBinding>
什麼是我做了錯誤的。請通過正確的方式指導我。
我已更改設置。但是仍然有400個錯誤出現:( – 2013-04-05 09:28:41
你是否更改過ReaderQuotas的設置?它們也應該與服務器上的設置相同... – 2013-04-05 09:30:53
是的。現在雙方的值都是相同的。 – 2013-04-05 09:32:50