简体   繁体   English

URI字符串太长异常-向node.js发出请求

[英]The URI string is too Long exception - Making a request to node.js

I just ran into this issue while making a GET request to a node.js server from .NET. 我刚从.NET向Node.js服务器发出GET请求时遇到了这个问题。 Ultimately, I am trying to pass a large JSON object through the query string. 最终,我试图通过查询字符串传递一个大型JSON对象。 I have been looking to see if there is a way to increase the size of the URI in .NET itself. 我一直在寻找是否有办法增加.NET本身中URI的大小。 I know that node has no restrictions on the size of the query string that it can accept. 我知道该节点对其可以接受的查询字符串的大小没有限制。 Is there a way to increase this size or are we better off changing this to a POST? 有没有办法增加此大小,还是最好将其更改为POST?

Thanks Kyle 谢谢凯尔

No, you cannot change it, because underlying all of Microsoft http technology is INTERNET_MAX_URL_LENGTH, which is defined to be 2083 characters. 不,您不能更改它,因为所有Microsoft http技术的基础都是INTERNET_MAX_URL_LENGTH,它被定义为2083个字符。

You should just use POST for everything. 您应该只对所有内容使用POST。 Odds are it isn't very difficult to make the switch. 奇怪的是,进行切换并不是很困难。

Use a POST. 使用POST。 IIS maxes out ~2000 characters for a GET request and even if it didn't each browser has a different maximum length with IE being the most restrictive. 对于GET请求,IIS 最多可以容纳 2000个字符,即使不是每个浏览器都有不同的最大长度 ,而IE也是最严格的。 In general keep GETs less than 2000 characters for maximum compatibility with all possible web clients otherwise switch to a POST. 通常,为了使与所有可能的Web客户端的兼容性最大化,请保持GETs少于2000个字符,否则切换到POST。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM