mono - 单声道结果中的 Web 服务调用“System.Net.WebException:请求超时”和“System.ObjectDisposedException:无法访问已处置的对象”
问题描述
当我尝试在 Linux 上使用单声道框架使用(SOAP)Web 服务(尝试使用 1 MB - 10 MB 大小的数据上传文件内容)时,会导致 System.Net.WebException:请求超时,如下所示:-
System.Net.WebException: The request timed out
at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse (System.Net.WebRequest request) [0x00063] in <347f9bd33bde43a99c01481e08ce58fa>:0
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse (System.Net.WebRequest request) [0x00000] in <347f9bd33bde43a99c01481e08ce58fa>:0
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (System.String methodName, System.Object[] parameters) [0x00047] in <347f9bd33bde43a99c01481e08ce58fa>:0
. . .
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Web.Services.Protocols.ContentType.GetBase (System.String contentType) [0x00000] in <edd24f1f06314427933a30c9e718af36>:0
at System.Web.Services.Protocols.ContentType.IsSoap (System.String contentType) [0x00000] in <edd24f1f06314427933a30c9e718af36>:0
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse (System.Web.Services.Protocols.SoapClientMessage message, System.Net.WebRespon
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (System.String methodName, System.Object[] parameters) [0x0005a] in <edd24f1f0631442
. . .
System.Net.WebException: Error: SecureChannelFailure (One or more errors occurred.) ---> System.AggregateException: One or more errors occurred. --->k
at System.Net.Sockets.Socket.Receive (System.Byte[] buffer, System.Int32 offset, System.Int32 size, System.Net.Sockets.SocketFlags socketFlags) [0x
at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, System.Int32 offset, System.Int32 size) [0x0009b] in <be150a3638134aadb1764231aa6bd
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, System.Int32 offset, System.Int32 size) [0x000e2] in <be150a3638134aadb1764231aa6bd
at Mono.Net.Security.MobileAuthenticatedStream+<>c__DisplayClass66_0.<InnerRead>b__0 () [0x0002b] in <be150a3638134aadb1764231aa6bdeff>:0
at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in <9cfb84a3362744818836eb884b85d151>:0
at System.Threading.Tasks.Task.Execute () [0x00010] in <9cfb84a3362744818836eb884b85d151>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <9cfb84a3362744818836eb884b85d151>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <9cfb84a3362744818836eb884b85d151
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <9cfb84a3362
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <9cfb84a3362744818836eb884b85d151>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <9cfb84a3362744818836eb884b85
at Mono.Net.Security.MobileAuthenticatedStream+<InnerRead>d__66.MoveNext () [0x000ff] in <be150a3638134aadb1764231aa6bdeff>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <9cfb84a3362744818836eb884b85d151>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <9cfb84a3362744818836eb884b85d151
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <9cfb84a3362
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <9cfb84a3362744818836eb884b85d151>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <9cfb84a3362744818836eb884b85
at Mono.Net.Security.AsyncProtocolRequest+<InnerRead>d__25.MoveNext () [0x000ac] in <be150a3638134aadb1764231aa6bdeff>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <9cfb84a3362744818836eb884b85d151>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <9cfb84a3362744818836eb884b85d151
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <9cfb84a3362
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <9cfb84a3362744818836eb884b85d151>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <9cfb84a3362744818836eb884b85
at Mono.Net.Security.AsyncProtocolRequest+<ProcessOperation>d__24.MoveNext () [0x00093] in <be150a3638134aadb1764231aa6bdeff>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <9cfb84a3362744818836eb884b85d151>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <9cfb84a3362744818836eb884b85d151
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <9cfb84a3362
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <9cfb84a3362744818836eb884b85d151>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <9cfb84a3362744818836eb884b85d151>:0
at Mono.Net.Security.AsyncProtocolRequest+<StartOperation>d__23.MoveNext () [0x0008b] in <be150a3638134aadb1764231aa6bdeff>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <9cfb84a3362744818836eb884b85d151>:0
at Mono.Net.Security.MobileAuthenticatedStream+<ProcessAuthentication>d__47.MoveNext () [0x00254] in <be150a3638134aadb1764231aa6bdeff>:0
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in <9cfb84a3362744818836eb884b85d151>:0
at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00043] in <9cfb84a3
at System.Threading.Tasks.Task.Wait () [0x00000] in <9cfb84a3362744818836eb884b85d151>:0
at Mono.Net.Security.MobileAuthenticatedStream.AuthenticateAsClient (System.String targetHost, System.Security.Cryptography.X509Certificates.X509Ce
at Mono.Net.Security.MonoTlsStream.CreateStream (System.Byte[] buffer) [0x0007b] in <be150a3638134aadb1764231aa6bdeff>:0
at System.Net.WebConnection.CreateStream (System.Net.HttpWebRequest request) [0x00073] in <be150a3638134aadb1764231aa6bdeff>:0
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetRequestStream (System.IAsyncResult asyncResult) [0x0003a] in <be150a3638134aadb1764231aa6bdeff>:0
at System.Net.HttpWebRequest.GetRequestStream () [0x0004e] in <be150a3638134aadb1764231aa6bdeff>:0
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (System.String methodName, System.Object[] parameters) [0x00029] in <edd24f1f0631442
在代理类中包含以下代码后
protected override WebRequest GetWebRequest (Uri uri)
{
HttpWebRequest webRequest = (HttpWebRequest)base.GetWebRequest (uri);
webRequest.KeepAlive = false;
webRequest.ProtocolVersion = HttpVersion.Version10;
return webRequest;
}
我看到 System.ObjectDisposedException:虽然上传成功并间歇性失败,但无法访问已处置的对象异常!
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.Sockets.NetworkStream'.
at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00058] in <be150a3638134aadb1764231aa6bdeff>:0
at System.Net.HttpWebRequest.GetResponse () [0x0000e] in <be150a3638134aadb1764231aa6bdeff>:0
at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse (System.Net.WebRequest request) [0x0003f] in <edd24f1f06314427933a30c9e718af36>:0
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse (System.Net.WebRequest request) [0x00000] in <edd24f1f06314427933a30c9e718af3
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (System.String methodName, System.Object[] parameters) [0x00047]
什么可能导致此问题,我该如何解决?
解决方案
推荐阅读
- regex - 正则表达式匹配 X 位数字或字母,但不匹配 X 行中的字母
- python - 询问马尔可夫模拟的结果 - 高度赞赏的帮助和反馈
- javascript - 进行加载过程时,Mouseover 和 Mouseout 不起作用
- android - 作为 Open Beta 发布的 Android 应用的可见性是否与公开发布相同?
- php - Laravel 为路由提供数组,并非所有值都是必需的
- html - 如何编写脚本来输出 html 文件?
- r - 两个 sf 对象的联合
- c - “curses.h:没有这样的文件或目录”即使安装到 Cygwin
- python-3.x - 如何运行 Flask 应用程序
- c++ - GetPhysicalMonitorsFromHMONITOR 不起作用