2009-11-13 41 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