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