Server Error in '/' Application.

An existing connection was forcibly closed by the remote host

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

Source Error:


Line 99:                     var bArq = arquivo.Arquivo1;
Line 100:                    if (!string.IsNullOrEmpty(arquivo.UrlStorage)) {
Line 101:                        WebClient myWebClient = new WebClient();
Line 102:                        bArq = myWebClient.DownloadData(arquivo.UrlStorage);
Line 103:                    }

Source File: C:\Git\iPortalGit\Portal\Modulos\ExibirArquivo.cs    Line: 101

Stack Trace:


[SocketException (0x2746): An existing connection was forcibly closed by the remote host]
   System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +225

[IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.]
   System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +893
   System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count) +48
   System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest) +130
   System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest) +276
   System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest) +357
   System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest, Boolean renegotiation) +241
   System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult) +833
   System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) +264
   System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) +21
   System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) +85
   System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result) +1135
   System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size) +60
   System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size) +120
   System.Net.ConnectStream.WriteHeaders(Boolean async) +487

[WebException: The underlying connection was closed: An unexpected error occurred on a send.]
   System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request) +389
   System.Net.WebClient.DownloadData(Uri address) +114
   iPortal.Modulos.ExibirArquivo.ProcessRequest(HttpContext context) in C:\Git\iPortalGit\Portal\Modulos\ExibirArquivo.cs:101
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +862
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +182
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +94


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.9224.0