Akshata S P
Akshata S P

Reputation: 11

Webservice call in mono results "System.Net.WebException:The request timed out" & "System.ObjectDisposedException:Cannot access a disposed object"

When I tried to consume (SOAP) web service (trying to uplaod file content with data of 1 MB - 10 MB size) using mono framework on Linux results in System.Net.WebException: The request timed out as below:-

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

After including below code in proxy class

protected override WebRequest GetWebRequest (Uri uri)
{
    HttpWebRequest webRequest = (HttpWebRequest)base.GetWebRequest (uri);
    webRequest.KeepAlive = false;
    webRequest.ProtocolVersion = HttpVersion.Version10;
    return webRequest;
}

I see System.ObjectDisposedException: Cannot access a disposed object exception though upload succeds and fails intermittently !

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]

What might causing this issue and how can I fix it?

Upvotes: 1

Views: 305

Answers (0)

Related Questions