WCF说,这超出最大的查询字符串值,而不是 [英] WCF says it exceeds maximum query string value while it is not

查看:289
本文介绍了WCF说,这超出最大的查询字符串值,而不是的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WCF服务(通过的WebHttpBinding )使用ASP.NET 4 / IIS 8,我曾与它使用JSON与 GET 。不过,今天我需要实现发送大量的查询字符串(约3000字,不就是长,但长于我一直在使用)的方法。我打电话到服务,并立刻得到了一个404错误,甚至没有踏进我的code我调试机器。即来到我的脑海里的第一件事是最大的查询字符串长度的限制。我已将此添加我的web.config:

I have a WCF service (over a webHttpBinding) using ASP.NET 4/IIS 8 and I had no problems communicating with it using JSON with GET. However, today I needed to implement a method that sends a large query string (about 3000 characters, not that long but longer than that I've been using). I called the service and immediately got a 404 error, without even stepping into my code at my debug machine. The first thing that came to my mind is the maximum query string length limit. I've added this to my web.config:

 <system.webServer>
    <directoryBrowse enabled="true" />
    <security>
      <requestFiltering>
        <requestLimits maxQueryString="8000"></requestLimits>
      </requestFiltering>
    </security>
  </system.webServer>

现在,我得到这个服务器的错误,当我拨打服务:的查询字符串的申请超过了配置maxQueryStringLength值够奇怪的,我的时间长度。已经尝试过其他的值,如 200000 ,在我的查询字符串和URL,这是约3000个字符的方式。我失去了一些东西?

Now, I am getting this server error when I call the service: The length of the query string for this request exceeds the configured maxQueryStringLength value. Weird enough, I've tried other values such as 200000, way over my query string and URL, which is about 3000 characters. Am I missing something?

推荐答案

也许设置 maxQueryStringLength 中的中的httpRuntime元素

这是一个有点混乱有两个配置设置,但我相信他们可以PTED跨$ P $如下:

It's a bit confusing to have two configuration settings, but I believe they can be interpreted as follows:

  • 的httpRuntime maxQueryStringLength属性是新的ASP.NET 4,并配置最大的查询字符串的长度,可以通过ASP.NET HTTP运行时处理。此前ASP.NET 4,这是2048硬连线值;现在可以增加

  • The httpRuntime maxQueryStringLength property is new to ASP.NET 4 and configures the maximum query string length that can be processed by the ASP.NET HTTP runtime. Prior to ASP.NET 4 this was a hardwired value of 2048; it can now be increased.

的System.Web /安全性/的requestFiltering maxQueryStringLength属性是一个IIS 7的设置,并允许管理员限制最大的查询字符串的长度。此设置不是特定于ASP.NET。

The system.web/security/requestFiltering maxQueryStringLength property is an IIS 7 setting and allows an administrator to restrict the maximum query string length. This setting isn't specific to ASP.NET.

这篇关于WCF说,这超出最大的查询字符串值,而不是的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆