2009-11-13 30 views
0

我使用asp.net scriptmanager进行Ajax调用。在场景后面,将数据作为查询字符串添加到url中并进行调用。但是当这些数据非常大时就会失败。使用大型查询字符串值的Ajax调用失败

我想如果我可以增加查询字符串最大宽度它将被解决。我如何更改asp.net中的maxquerystring大小。

此错误不是由于浏览器限制,因为它被服务器抛出。

服务是针对ajax公开的WCF服务。

错误是

Exception Type: System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail] 
Exception: Buffer cannot be null. 
Parameter name: buffer 
Source: DefaultPage 
Stack Trace: 

Server stack trace: 
    at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter) 
    at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) 
    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) 
    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs) 
    at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) 
    at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) 

所以这里形成像http://site/ajax.svc?data=xxxxxxxxxxxxxxxxxxxx网址

大意味着它得到大约1000个字符长。

我在哪里可以设置允许的最大URL大小或什么。

我明白这类数据需要使用post来提交而不是get,但这就是scriptmanager的工作方式,所以想通过扩展这个限制来获得解决方案。

回答

2

你可以考虑使用$ .POST

+0

谢谢,我已经取得了进展和后期使用 – mamu 2009-11-15 21:24:46

2

查询字符串的最大长度不能以编程方式设置,它由请求中涉及的Web服务器和浏览器决定。

查看维基百科条目的兼容性问题部分以获取详细信息以及指向其他资源的链接。

http://en.wikipedia.org/wiki/Query_string