寻找最佳的 WCF 配额设置
我知道,我的问题有点空洞,但您认为 WCF 配额的“最佳”设置是什么,例如 MaxReceivedMessageSize 等?
我的服务大多返回较小的值,但有时返回值会超出默认配额。还有更大的返回值,我将其作为流返回到第二个端点。
现在,我认为 MaxReceivedMessageSize 的默认值(毫无疑问,流式端点使用更高的值;我的问题涉及缓冲通信)65536 字节相当低。有大量的“教程”只是将此值设置为 Int32.MaxValue,这根本不是一个好主意;) 那么你觉得怎么样?哪些值是可行的,但也足够安全,不会让您的服务容易受到 DoS 和其他攻击?
问候
I know, my question is kinda wishy washy, but what would you say are "optimal" settings for WCF quotas, e.g. MaxReceivedMessageSize etc.?
My service mostly returns small values, but sometimes the return values exceed the default quotas. There are even larger return values, which I return as streams at a second endpoint.
Now the default value for MaxReceivedMessageSize (no question, the streamed endpoint uses higher values; my question concerns buffered communication) of 65536 bytes is quite low, I think. There are tons of "tutorials" which just set this value to Int32.MaxValue, which isn't a good idea at all ;)
Well what do you think? Which values are viable but are also safe enough not to make your service vulnerable for DoS and other stuff?
Regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Vialbe 值实际上取决于您期望的数据大小。如果您知道有时可以达到 256KB,则将该值设置为 256KB。在内部服务的情况下,限制可能会设置为 Int32.MaxValue ,但我认为这更多的是关于对传输数据做出假设的惰性。对于公共 Web 服务,您几乎不会将值设置为
Int32.MaxValue
,因为任何人都可以炸毁您的服务器。顺便提一句。如果我们谈论的是从服务返回的数据,那么这个决定权在客户端 - 配额和 MaxReceiveMessageSize 目标都是接收消息而不是发送消息,因此如果您的服务返回数据以响应客户端的请求,则限制将为在客户端设置。例如,在公共 Web 服务的情况下,您无法控制所有客户端,因此您还必须考虑要返回多少数据。
单独的端点是客户端和服务器端的单独配置。
Vialbe value really depends on the size of data you are expecting. If you know that sometimes you can get up to 256KB then set the value to 256KB. In case of internal service the limit can be probably set to
Int32.MaxValue
but I think it is much more about lazyness of making the assumtion about transferred data. For a public web service you will hardly set the value toInt32.MaxValue
because anybody will be able to blow up your server.Btw. if we are talking about data returned from the service then this decission is on the client - both quotas and
MaxReceiveMessageSize
target receiving message not sending message so if your service returns data in response to client's requests the limit will be set on the client side. For example in case of public web service you don't have all clients under your control so you must also consider how much data do you want to return.A separate endpoint is separate configuration on both client and server sides.