WCF REST POST 操作抛出 413(实体太大)错误
我使用内置项目模板创建了一个基于 WCF REST 的服务。一切都工作得很好,除了当我尝试将文件(作为流)“发布”到我的其中一个操作时,我始终收到 413(实体太大)响应。
我查看了与 WCF 相关的所有其他 413 个问题,它们都与非 REST 服务和/或 IIS6 配置相关,并提到了
或 <绑定>
属性。
有什么想法吗?
I've created, using the built-in project template, a WCF REST-based service. Everything works just great except that when I attempt to "POST" a file (as a stream) to one of my operations, I'm consistently getting a 413 (Entity Too Large) response.
I've looked at all the other 413 questions related to WCF and they're all related to non-REST services and/or IIS6 configurations and mention either the <system.Web>
or <binding>
properties.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
嗯……我想通了!
事实证明,有效的设置必须应用于 system.serviceModel 节点内的 standardEndpoint 节点:
Well... I figured it out!
It turns out that the setting which worked is one which has to be applied to the standardEndpoint node inside system.serviceModel node:
检查配置文件 maxmessagesize 等中的配额和最大值。默认值为 8192、16384、65536
Check the quotas and max's in your config file maxmessagesize, etc. defaults are 8192, 16384, 65536
我似乎遇到了同样的问题,最终不得不为我的 RESTful 服务创建自定义绑定并增加 maxReceivedMessageSize 设置。
I had seemingly the same issue and ended up having to create a custom binding for my RESTful service and increase the maxReceivedMessageSize setting.
我会检查 IIS 中设置的最大上传大小。过去,当我尝试发布文件时,这一直是问题。对于任何实际需要处理文件上传的应用程序来说,它通常设置得太小。
I would check the max upload size set in IIS. In the past, that has been the issue when I have tried to post files. It is usually set too small for any application that actually needs to deal with file uploads.