【发布时间】:2012-11-10 00:52:17
【问题描述】:
我有一个 Web 服务方法,它返回一个对象列表 List<T>
当列表长度在9000个左右时,服务会很好地返回这个列表,但是当长度在12000个或更多对象时,服务会返回错误:
底层连接已关闭:连接意外关闭。
`System.Reflection.TargetInvocationException:调用的目标已抛出异常。 ---> Microsoft.FSharp.Core.FailureException:System.Net.WebException:底层连接已关闭:连接意外关闭。 在 System.Net.HttpWebRequest.GetResponse() 在 .$Type.httprequest.webRespBase@162@162(DelegatingHttpReq x@162, Unit _unit) 在 .$Type.httprequest.webRespBase@162@162(DelegatingHttpReq x@162, Unit _unit) 在 Storm.Types.WebHttp.DelegatingHttpReq.GetResponse() 在 System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest 请求) 在 System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest 请求) 在 System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(字符串方法名,对象 [] 参数) 在 ServiceLogic.LoadRestrictcionCanalPlano(String CodRuta, String CodTipoRuta)
---内部异常堆栈跟踪结束---
在 System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) 在 System.Reflection.RuntimeMethodInfo.Invoke(Object obj,BindingFlags invokeAttr,Binder binder,Object[] 参数,CultureInfo 文化,布尔型 skipVisibilityChecks) 在 System.Reflection.RuntimeMethodInfo.Invoke(Object obj,BindingFlags invokeAttr,Binder binder,Object[] 参数,CultureInfo 文化) 在 Storm.UI.Forms.FormMainOps.clo@651.Invoke(Object[] methodParams@41) 在 .$Type.bgworker.run@51@57_2.Invoke(DoWorkEventArgs dArgs) 在 .$Type.bgworker.run@51@57_1.Invoke(对象发送者,DoWorkEventArgs e) 在 System.ComponentModel.BackgroundWorker.WorkerThreadStart(对象参数)`
我尝试在 Web.config 的绑定配置中更改 maxBufferSize maxBufferPoolSize maxReceivedMessageSize maxStringContentLength maxArrayLength 等,但仍然无法正常工作。
还有其他想法吗?
【问题讨论】:
-
仅供参考,看起来您使用的是服务参考,而不是 Web 参考。这是正确的举动,顺便说一句。
标签: wcf web-services reflection