CONFIG最大消息长度

CONFIG最大消息长度

本文介绍了WEB.CONFIG最大消息长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要发布一个包含大量文本的json对象.

I'm posting a json object with large amount of text.

下面是我当前的 web.config .我应该如何修改以更改消息大小以发布较大的json?

Below is my current web.config. How should I modify to change message size to post large json?

这很紧急,请尽快答复.谢谢!

This is urgent, pls reply fast. thanks!

<?xml version ="1.0"?>
<?xml version="1.0"?>

推荐答案

如此设置

maxRequestLength,maxBufferSize,maxBufferPoolSize,maxReceivedMessageSize改为2147483647

maxRequestLength,maxBufferSize,maxBufferPoolSize,maxReceivedMessageSize to 2147483647

使用ReaderQuotas如下.

< readerQuotas maxDepth = " 2147483647" maxStringContentLength = " ; 2147483647""  
             
maxArrayLength = " ; 2147483647"" maxBytesPerRead = " ; 2147483647""  
             
maxNameTableCharCount = " ; 2147483647"" />  

<readerQuotas maxDepth="2147483647"maxStringContentLength="2147483647" 
             
maxArrayLength="2147483647"maxBytesPerRead="2147483647" 
             
maxNameTableCharCount="2147483647"/> 

注意

主要缺点是可能容易受到攻击-例如恶意源现在可以用最多2 GB的邮件淹没您的Web服务器,并有可能将其清除.

The main drawback is a potential vulnerability to attacks - e.g. a malicious source can now flood your webserver with message up to 2 GB in size and potentially bring it down.

当然,允许2 GB的消息还会对服务器的内存消耗造成一定的压力,因为这些消息需要完全在内存中组装(除非您在WCF中使用流协议).如果您有10个客户端向您发送2 GB的邮件, 您的服务器上将需要大量RAM! :-)

Of course, allowing 2 GB messages also puts some strain on your server in terms of memory consumption, since those messages need to be assembled in memory, in full (unless you use streaming protocols in WCF). If you have 10 clients sending you 2 GB messages, you'll need plenty of RAM on your server! :-)

除此之外,我没有看到任何实际问题.

Other than that, I don't see any real issues.


这篇关于WEB.CONFIG最大消息长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 15:05