Cannot catch wcf service exception in biztalk orchestration - exception

I'm trying to put exception handling into my working orchestration and cannot get the exception caught. It keeps suspending the message instead of executing my exception block to handle it more gracefully.
Any suggestions?
Here are the event log messages I'm getting:
A message sent to adapter "WCF-Custom" on send port "InsertOracleMasterPort" with URI "oracledb://svd0odbd01:1529/ebsdev/Dedicated" is suspended.
Error details: Microsoft.ServiceModel.Channels.Common.ConnectionException: ORA-1017: invalid username/password; logon denied ---> Oracle.DataAccess.Client.OracleException: ORA-1017: invalid username/password; logon denied
at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck)
at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src)
at Oracle.DataAccess.Client.OracleConnection.Open()
at Microsoft.Adapters.OracleCommon.OracleCommonConnectionWrapper..ctor(String connectionString, OracleCommonExecutionHelper executionHelper)
at Microsoft.Adapters.OracleDB.OracleDBConnection.Microsoft.ServiceModel.Channels.Common.IConnection.Open(TimeSpan timeout)
--- End of inner exception stack trace ---
Server stack trace:
at Microsoft.Adapters.OracleDB.OracleDBConnection.Microsoft.ServiceModel.Channels.Common.IConnection.Open(TimeSpan timeout)
at Microsoft.ServiceModel.Channels.Common.Design.ConnectionPool.GetConnection(Guid clientId, TimeSpan timeout)
at Microsoft.ServiceModel.Channels.Common.Design.ConnectionPool.GetConnectionHandler[TConnectionHandler](Guid clientId, TimeSpan timeout, MetadataLookup metadataLookup, String& connectionId)
at Microsoft.ServiceModel.Channels.Common.Channels.AdapterRequestChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open()
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at System.ServiceModel.ICommunicationObject.Open()
at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.GetChannel[TChannel](IBaseMessage bizTalkMessage, ChannelFactory`1& cachedFactory)
at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.SendMessage(IBaseMessage bizTalkMessage)
MessageId: {1CC95FB3-E543-4011-9BDD-EABB50B75BC2}
InstanceID: {EF352982-D16C-421E-806C-58E432049951}
Second message:
xlang/s engine event log entry: Uncaught exception (see the 'inner exception' below) has suspended an instance of service 'Orchestrations.OracleInvoice(868ee765-7874-ec30-0cc7-f81ae5ebfb2b)'.
The service instance will remain suspended until administratively resumed or terminated.
If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.
InstanceId: 7eefaf7e-0e9c-4ee6-be6e-7030ece2058b
Shape name:
ShapeId:
Exception thrown from: segment -1, progress -1
Inner exception: An error occurred while processing the message, refer to the details section for more information
Message ID: {1CC95FB3-E543-4011-9BDD-EABB50B75BC2}
Instance ID: {EF352982-D16C-421E-806C-58E432049951}
Error Description: Microsoft.ServiceModel.Channels.Common.ConnectionException: ORA-1017: invalid username/password; logon denied ---> Oracle.DataAccess.Client.OracleException: ORA-1017: invalid username/password; logon denied
at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck)
at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src)
at Oracle.DataAccess.Client.OracleConnection.Open()
at Microsoft.Adapters.OracleCommon.OracleCommonConnectionWrapper..ctor(String connectionString, OracleCommonExecutionHelper executionHelper)
at Microsoft.Adapters.OracleDB.OracleDBConnection.Microsoft.ServiceModel.Channels.Common.IConnection.Open(TimeSpan timeout)
--- End of inner exception stack trace ---
Server stack trace:
at Microsoft.Adapters.OracleDB.OracleDBConnection.Microsoft.ServiceModel.Channels.Common.IConnection.Open(TimeSpan timeout)
at Microsoft.ServiceModel.Channels.Common.Design.ConnectionPool.GetConnection(Guid clientId, TimeSpan timeout)
at Microsoft.ServiceModel.Channels.Common.Design.ConnectionPool.GetConnectionHandler[TConnectionHandler](Guid clientId, TimeSpan timeout, MetadataLookup metadataLookup, String& connectionId)
at Microsoft.ServiceModel.Channels.Common.Channels.AdapterRequestChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open()
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at System.ServiceModel.ICommunicationObject.Open()
at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.GetChannel[TChannel](IBaseMessage bizTalkMessage, ChannelFactory`1& cachedFactory)
at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.SendMessage(IBaseMessage bizTalkMessage)
Exception type: XlangSoapException
Source: Microsoft.XLANGs.BizTalk.Engine
Target Site: Void VerifyTransport(Microsoft.XLANGs.Core.Envelope, Int32, Microsoft.XLANGs.Core.Context)
The following is a stack trace that identifies the location where the exception occured
at Microsoft.BizTalk.XLANGs.BTXEngine.BTXPortBase.VerifyTransport(Envelope env, Int32 operationId, Context ctx)
at Microsoft.XLANGs.Core.Subscription.Receive(Segment s, Context ctx, Envelope& env, Boolean topOnly)
at Microsoft.XLANGs.Core.PortBase.GetMessageId(Subscription subscription, Segment currentSegment, Context cxt, Envelope& env, CachedObject location)
at Orchestrations.OracleInvoice.segment2(StopConditions stopOn)
at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)
Here's the orchestration:
The catch blocks use these types of error objects:
System.Web.Services.Protocols.SoapException
Microsoft.XLANGs.Core.XlangSoapException
Microsoft.XLANGs.BaseTypes.XLANGsException
General Exception
System.Exception
I thought the exception handling would bubble up and be caught in the system.exception or general handlers but that doesn't happen.

based on those posts it look like you need to create and catch wcf fault exeption
example 1
example 2

Related

SQL Reporting Service 2016: "Could not load folder contents."

I'm getting the error: "Could not load folder." when I want to open the webportal (http://<server nama>/Reports).
Here is the error message in logfile:
Microsoft.ReportingServices.Portal.WebHost!reportserverwebapp!14!09/21/2020-11:25:31:: e ERROR:
[obxnt7ls]: OData exception occurred: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentOutOfRangeException: The UTC time represented when the offset is applied must be between year 0 and 10,000.
Parameter name: offset
at System.DateTimeOffset.ValidateDate(DateTime dateTime, TimeSpan offset)
at System.DateTimeOffset..ctor(DateTime dateTime)
at System.DateTimeOffset.op_Implicit(DateTime dateTime)
at Microsoft.ReportingServices.Portal.Repositories.CatalogItemFactory.PopulateCommonFields(CatalogItemDescriptor itemDescriptor, CatalogItem catalogItem)
at Microsoft.ReportingServices.Portal.Repositories.CatalogItemFactory.CreateFolderCatalogItem(CatalogItemDescriptor itemDescriptor)
at Microsoft.ReportingServices.Portal.Repositories.CatalogItemFactory.Create(CatalogItemDescriptor itemDescriptor, Action`1 rsLoader)
at Microsoft.ReportingServices.Portal.Repositories.CatalogItemFactory.Create(FavoriteableCatalogItemDescriptor itemDescriptor)
at Microsoft.ReportingServices.Portal.Repositories.CatalogItemRepository.<>c__DisplayClasse.<TraverseFolder>b__b(FavoriteableCatalogItemDescriptor i)
at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at Model.FolderRepository.LoadCatalogItems()
at Model.Folder.get_CatalogItems()
--- End of inner exception stack trace ---

Mysql:An established connection was aborted by the software in your host machine

I got this error massage in MySQL, it was not blocked by firewall/anti-virus software. It happened when some task which is resource-intensive was launched.
Someone mention that it may cause by process priority issue
https://bugs.mysql.com/bug.php?id=76597
How can I do?
Error Msg:
MySql.Data.MySqlClient.MySqlException (0x80004005): Authentication to host 'localhost' for user 'xxx' using method 'mysql_native_password' failed with message: Reading from the stream has failed.
---> MySql.Data.MySqlClient.MySqlException (0x80004005): Reading from the stream has failed.
---> System.IO.IOException: Unable to read data from the transport connection: An established connection was aborted by the software in your host machine.
---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at MySql.Data.Common.MyNetworkStream.HandleOrRethrowException(Exception e)
at MySql.Data.Common.MyNetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.TimedStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.BufferedStream.Read(Byte[] array, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.MySqlStream.ReadFully(Stream stream, Byte[] buffer, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.MySqlStream.LoadPacket()
at MySql.Data.MySqlClient.MySqlStream.LoadPacket()
at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.ReadPacket()
at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.AuthenticationFailed(Exception ex)
at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.ReadPacket()
at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.Authenticate(Boolean reset)
at MySql.Data.MySqlClient.NativeDriver.Open()
at MySql.Data.MySqlClient.Driver.Open()
at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
at MySql.Data.MySqlClient.MySqlPool.GetConnection()
at MySql.Data.MySqlClient.MySqlConnection.Open()
at SecureDockDataAccess.DBAccess.Execute(String sql)

Why do we get "An unexpected error occurred in Report Processing" in SSRS 2008?

We often see this kind of errors in SSRS log file. This seems like internal error happening inside SSRS engine. How can we debug this ? We are not getting any other relevant information when report fails.
library!ReportServer_0-1!2864!09/09/2016-00:28:15:: w WARN:
Microsoft.ReportingServices.ReportProcessing.ReportProcessingException:
An unexpected error occurred in Report Processing. --->
System.Threading.ThreadAbortException: Thread was being aborted. at
Microsoft.Win32.Win32Native.SetFilePointerWin32(SafeFileHandle handle,
Int32 lo, Int32* hi, Int32 origin) at
Microsoft.Win32.Win32Native.SetFilePointer(SafeFileHandle handle,
Int64 offset, SeekOrigin origin, Int32& hr) at
System.IO.FileStream.SeekCore(Int64 offset, SeekOrigin origin) at
System.IO.FileStream.Seek(Int64 offset, SeekOrigin origin) at
Microsoft.ReportingServices.Library.PartitionFileStream.Seek(Int64
offset, SeekOrigin origin) at
Microsoft.ReportingServices.Library.MemoryUntilThresholdStream.Seek(Int64
offset, SeekOrigin origin) at
Microsoft.ReportingServices.Library.RSStream.Seek(Int64 offset,
SeekOrigin origin) at System.IO.BufferedStream.Seek(Int64 offset,
SeekOrigin origin) at
Microsoft.ReportingServices.Rendering.RPLProcessing.RPLReader.ReadElementProps(Int64
startOffset, RPLContext context, Byte& elementType) at
Microsoft.ReportingServices.Rendering.ExcelRenderer.Layout.LayoutEngine.RenderNewItem(IRowItemStruct
item, Int32 top, Int32 topRow, IExcelGenerator excel, String
pageContentKey, Dictionary2 sharedBorderCache, Dictionary2
sharedImageCache, Boolean& autosizableGrow, Boolean&
autosizableShrink) at
Microsoft.ReportingServices.Rendering.ExcelRenderer.Layout.LayoutEngine.RenderPageToExcel(IExcelGenerator
excel, String key, Dictionary2 sharedBorderCache, Dictionary2
sharedImageCache) at
Microsoft.ReportingServices.Rendering.ExcelRenderer.MainEngine.RenderRPLPage(RPLReport
report, Boolean headerInBody, Boolean suppressOutlines) at
Microsoft.ReportingServices.Rendering.ExcelRenderer.ExcelRenderer.Render(Report
report, NameValueCollection reportServerParameters,
NameValueCollection deviceInfo, NameValueCollection
clientCapabilities, Hashtable& renderProperties,
CreateAndRegisterStream createAndRegisterStream) at
Microsoft.ReportingServices.ReportProcessing.Execution.RenderReport.InvokeRenderer(IRenderingExtension
renderer, Report report, NameValueCollection reportServerParameters,
NameValueCollection deviceInfo, NameValueCollection
clientCapabilities, Hashtable& renderProperties,
CreateAndRegisterStream createAndRegisterStream) at
Microsoft.ReportingServices.ReportProcessing.Execution.RenderReport.Execute(IRenderingExtension
newRenderer) --- End of inner exception stack trace --- at
Microsoft.ReportingServices.ReportProcessing.Execution.RenderReport.Execute(IRenderingExtension
newRenderer) at
Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RenderReport(DateTime
executionTimeStamp, ProcessingContext pc, RenderingContext rc,
IChunkFactory yukonCompiledDefinition) at
Microsoft.ReportingServices.Library.RenderLive.CallProcessingAndRendering(ProcessingContext
pc, RenderingContext rc, OnDemandProcessingResult& result) at
Microsoft.ReportingService
webserver!ReportServer_0-1!2864!09/09/2016-00:28:16:: e ERROR:
Throwing
Microsoft.ReportingServices.Diagnostics.Utilities.UnhandledHttpApplicationException:
,
Microsoft.ReportingServices.Diagnostics.Utilities.UnhandledHttpApplicationException:
The report server encountered an unhandled exception in
HttpApplication. ---> System.Web.HttpException: Request timed out.
--- End of inner exception stack trace ---;
--------- UPDATE ----------
I see new error in log as
library!WindowsService_0!e88!09/09/2016-17:09:45:: e ERROR: Throwing
Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerStorageException:
, An error occurred within the report server database. This may be
due to a connection failure, timeout or low disk condition within the
database.; dbcleanup!WindowsService_0!e88!09/09/2016-17:09:45:: e
ERROR: Error in CleanOrphanedSnapshots:
Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerStorageException:
An error occurred within the report server database. This may be due
to a connection failure, timeout or low disk condition within the
database. ---> System.Data.SqlClient.SqlException: Timeout expired.
The timeout period elapsed prior to completion of the operation or the
server is not responding.
library!WindowsService_0!e88!09/09/2016-17:09:45:: i INFO: Cleaned 0
batch records, 0 policies, 0 sessions, 0 cache entries, 0 snapshots, 0
chunks, 4 running jobs, 0 persisted streams, 0 segments, 0 segment
mappings, 0 edit sessions.
--------- UPDATE ----------
After updating all the timeout to 12hr and Put DO NOT TIMEOUT setting on SSRS site setting, we see diff error now.
So far we have checked execution log and it shows no error. Below error is found inside ssrs log file. Server has 32gb memory and we run on 64bit OS. This report sometimes is generated fine and its 200MB in size.
httpruntime!ReportServer_0-2!58dc!09/12/2016-23:26:45:: e ERROR:
Failed in BaseWorkerRequest::SendHttpResponse(bool),
exception=System.Runtime.InteropServices.COMException (0x800703E3):
The I/O operation has been aborted because of either a thread exit or
an application request. (Exception from HRESULT: 0x800703E3) at
Microsoft.ReportingServices.HostingInterfaces.IRsHttpPipeline.SendResponse(Void*
response, Boolean finalWrite, Boolean closeConn) at
ReportingServicesHttpRuntime.BaseWorkerRequest.SendHttpResponse(Boolean
finalFlush) library!ReportServer_0-2!58dc!09/12/2016-23:26:45:: e
ERROR: Throwing
Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerHttpRuntimeInternalException:
RsWorkerRequest::FlushResponse.,
Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerHttpRuntimeInternalException:
An internal or system error occurred in the HTTP Runtime object for
application domain ReportServer_REPCENTER_0-2-131182052998828671.
---> System.Runtime.InteropServices.COMException (0x800703E3): The I/O operation has been aborted because of either a thread exit or an
application request. (Exception from HRESULT: 0x800703E3) at
ReportingServicesHttpRuntime.BaseWorkerRequest.SendHttpResponse(Boolean
finalFlush) at
ReportingServicesHttpRuntime.RsWorkerRequest.FlushResponse(Boolean
finalFlush) --- End of inner exception stack trace ---;
Finally we have answer to this. Its the recyletime element inside "rsreportserver.config" file. By default this element value is set to 720 min (12 hr). This means from the time you start the SSRS service, it will recycle every 12 hr. Our service was started during mid night release this means it kept recycling everyday at noon. We have since update this value to 24 hr.
<RecycleTime>1440</RecycleTime>
<MaxAppDomainUnloadTime>60</MaxAppDomainUnloadTime>

Exception thrown by type initializer for 'Microsoft.TeamFoundation.Framework.Server.ByteArray'

Please anyone has an idea what is causing this error while checking in files on tfs:
"The type initializer for 'Microsoft.TeamFoundation.Framework.Server.ByteArray' threw an exception."
this is the stack trace from the event Viewer:
**TF53010: The following error has occurred in a Team Foundation component or extension:
Date (UTC): 4/7/2014 5:57:14 AM
Machine: TFSSRV
Application Domain: /LM/W3SVC/8080/ROOT/tfs-14-130413234339367965
Assembly: Microsoft.TeamFoundation.Framework.Server, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; v2.0.50727
Service Host: 61e34d8a-3995-492a-b0b1-b1ca43304366 (SABIS)
Process Details:
Process Name: w3wp
Process Id: 3896
Thread Id: 4844
Account name: INTEREDLB\eghanem
Detailed Message: TF30065: An unhandled exception occurred.
Web Request Details
Url: tfssrv:8080/tfs/_tfs_resources/VersionControl/v1.0/upload.ashx [method: POST]
User Agent: Team Foundation (devenv.exe, 10.0.30319.1)
Headers: Content-Length=125836&Content-Type=multipart%2fform-data%3b+boundary%3d--------------------------8e5m2D6l5Q4h6&Accept-Language=en-US&Authorization=NTLM+TlRMTVNTUAADAAAAGAAYAIQAAABcAVwBnAAAABIAEgBYAAAADgAOAGoAAAAMAAwAeAAAAAAAAAD4AQAABYKIogYC8CMAAAAPEamXFnqofvmag9Tv7MumY0kATgBUAEUAUgBFAEQATABCAGUAZwBoAGEAbgBlAG0ASQBUAFEAQwAwADIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgPJ7o8t9UpE1fWPVvOiQkwEBAAAAAAAAOSm6OSZSzwGLmc3OzEbnlAAAAAACABIASQBOAFQARQBSAEUARABMAEIAAQAMAFQARgBTAFMAUgBWAAQAJgBpAG4AdABlAHIAZQBkAGwAYgAuAHMAYQBiAGkAcwAuAG4AZQB0AAMANAB0AGYAcwBzAHIAdgAuAGkAbgB0AGUAcgBlAGQAbABiAC4AcwBhAGIAaQBzAC4AbgBlAHQABQASAHMAYQBiAGkAcwAuAG4AZQB0AAgAMAAwAAAAAAAAAAEAAAAAIAAAPo4lTXR7%2fzg5WQsBAME%2f5oXFLmv2XYbJUNBj1fLeBfkKABAAAAAAAAAAAAAAAAAAAAAAAAkAPgBIAFQAVABQAC8AdABmAHMAcwByAHYALgBpAG4AdABlAHIAZQBkAGwAYgAuAHMAYQBiAGkAcwAuAG4AZQB0AAAAAAAAAAAA&Expect=100-continue&Host=tfssrv%3a8080&User-Agent=Team+Foundation+(devenv.exe%2c+10.0.30319.1)&X-TFS-Version=1.0.0.0&X-TFS-Session=f705371b-1a30-4e4a-861c-62d652add5e3&TF-Instance=f705371b-1a30-4e4a-861c-62d652add5e3
Path: /tfs/_tfs_resources/VersionControl/v1.0/upload.ashx
Local Request: False
Host Address: 192.168.200.234
User: INTEREDLB\eghanem [authentication type: NTLM]
Exception Message: The type initializer for 'Microsoft.TeamFoundation.Framework.Server.ByteArray' threw an exception. (type TypeInitializationException)
Exception Stack Trace: at Microsoft.TeamFoundation.Framework.Server.ByteArray..ctor(Int32 sizeRequested)
at Microsoft.TeamFoundation.VersionControl.Server.UploadHandler.UploadFile(VersionControlRequestContext versionControlRequestContext, String workspaceName, String workspaceOwner, String serverItem, Byte[] hash, Stream fileStream, Int64 fileLength, Int64 compressedLength, Int64 offsetFrom, CompressionType compressionType)
at Microsoft.TeamFoundation.VersionControl.Server.TeamFoundationVersionControlService.UploadFile(TeamFoundationRequestContext requestContext, String workspaceName, String workspaceOwner, String serverItem, Byte[] hash, Stream fileStream, Int64 fileLength, Int64 compressedLength, Int64 offsetFrom, CompressionType compressionType)
at Microsoft.TeamFoundation.VersionControl.Server.UploadHandler.Execute()
Inner Exception Details:
Exception Message: Exception of type 'System.OutOfMemoryException' was thrown. (type OutOfMemoryException)
Exception Stack Trace: at Microsoft.TeamFoundation.Framework.Server.BufferPool..ctor(Int32 bufferSize, Int32 initialNumberOfEntries)
at Microsoft.TeamFoundation.Framework.Server.ByteArray..cctor()
For more information, see Help and Support Center at**
I was encountering the same issue just today. For the sake of others that may hit this page, since it's the first hit when googling the exception. I looked at the MS Social question here, but the key appears to be something in the App Tier Framework, I executed IISRESET.exe (as Administrator) on the TFS app tier server and everything started working perfectly again.

Downloading a file from http location, I get the following error

Scenario
Downloading an xlsx file to my local drive from a http location using a execute script task .
ERROR
Error: 0x1 at Script Task: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized.
at System.Net.WebClient.DownloadFile(Uri address, String fileName)
at ST_3926c89e45574d05b1869761d015ffc0.csproj.ScriptMain.Main()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()
Task failed: Script Task
Warning: 0x80019002 at Package: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (1) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.
SSIS package "Package.dtsx" finished: Failure.
Based on the code provided in your previous (and open) question I presume you would need to set the Credentials property on the HttpWebRequest. Without knowing the specifics of your credential situation, I cannot say whether the DefaultCredentials will work or whether you will need to provide a user & password.
wr.Credentials = System.Net.CredentialCache.DefaultCredentials;