WCF错误:413 Request Entity Too Large
来源:互联网 发布:c语言棱形 编辑:程序博客网 时间:2024/06/05 06:14
在我们用WCF传输数据的时候,如果启用默认配置,传输的数据量过大,经常会出这个错误。
WCF包含服务端与客户端,所以这个错误可能出现在服务端返回数据给客户端,或客户端传数据给服务端时。
1. 服务端返回数据给客户端报错
在客户端配置文件中,主要是配置maxReceivedMessageSize
<system.serviceModel> <bindings> <basicHttpBinding> <binding name="ServiceProxyBinding" closeTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> <readerQuotas maxStringContentLength="134217728" /> </binding> </basicHttpBinding> </bindings> <client> <endpoint address="http://localhost:5239/AHMTService/PartService.svc" binding="basicHttpBinding" bindingConfiguration="ServiceProxyBinding" contract="UniCloud.ServiceContracts.IPartService" name="IPartService" /> </client> </system.serviceModel>
2 客户端传数据给服务端报错
修改服务端web.config,主要也是配置maxReceivedMessageSize
<system.serviceModel> <services> <!--DecodeService 服务端配置 增加接收文件大小--> <service name="UniCloud.Services.DecodeService" behaviorConfiguration="MyServiceBehaviour" > <endpoint address="" binding="basicHttpBinding" bindingConfiguration="MyServiceBinding" contract="UniCloud.ServiceContracts.IDecodeService"> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> <host> <baseAddresses> <add baseAddress="http://localhost:5239/AHMTService"/> </baseAddresses> </host> </service> </services> <bindings> <basicHttpBinding> <binding name="MyServiceBinding" closeTimeout="00:10:00" receiveTimeout="00:20:00" sendTimeout="00:20:00"maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> <security mode="None"></security> </binding> </basicHttpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="MyServiceBehaviour"> <!-- 为避免泄漏元数据信息,请在部署前将以下值设置为 false --> <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" /> <!-- 要接收故障异常详细信息以进行调试,请将以下值设置为 true。在部署前设置为 false 以避免泄漏异常信息 --> <serviceDebug includeExceptionDetailInFaults="true" /> <dataContractSerializer maxItemsInObjectGraph="2147483647"/> </behavior> </serviceBehaviors> </behaviors> <protocolMapping> <add binding="basicHttpsBinding" scheme="https" /> </protocolMapping> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> </system.serviceModel>
其实要修改所有的服务,不管是服务端还是客户端,Binding那边增加一个没有设置名字的默认配置就OK了
<binding closeTimeout="00:10:00" receiveTimeout="00:20:00" sendTimeout="00:20:00"maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
0 0
- WCF错误:413 Request Entity Too Large
- WCF:(413) Request Entity Too Large.
- 413 Request Entity Too Large错误解决办法
- 413 Request Entity Too Large
- 413 Request Entity Too Large
- 413 Request Entity Too Large
- 413 Request Entity Too Large
- 413 Request Entity Too Large
- 上传图片 出现错误:413 Request Entity Too Large
- Nginx出现“413 Request Entity Too Large”错误解决方法
- Nginx出现的413 Request Entity Too Large错误
- svn 413 Request Entity Too Large 错误的解决方法
- Nginx出现413 Request Entity Too Large错误解决方法
- Nginx “413 Request Entity Too Large”错误解决方法
- Nginx出现413 Request Entity Too Large错误解决方法
- Nginx出现“413 Request Entity Too Large”错误解决方法
- Nginx出现413 Request Entity Too Large错误解决方法
- Nginx出现413 Request Entity Too Large错误解决方法
- 当label半透明后导致 内容 模糊的问题
- C语言数据类型、运算符与表达式
- 如何正确编译 dashcast 和 ffmpeg
- windows套接字编程过程
- LeetCode Unique Paths(dp)
- WCF错误:413 Request Entity Too Large
- CocoaPods的安装和使用
- c++智能指针:auto_ptr shared_ptr
- Android进步之路十:Handler修改UI界面之Demo
- TableViewCell高度自适应的实现方案
- 黑马程序员——Java高新技术_反射
- asynctask 异步线程类进行多线程操作
- Kth Largest Element in an Array
- UML之类图