Click here to Skip to main content
15,888,286 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Guys,

I am getting following Exception when i tried to download the generated pdf report file path using SSRS Service

The handle is invalid. (Exception from HRESULT: 0x80070006 (E_HANDLE))
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.Runtime.InteropServices.COMException: The handle is invalid. (Exception from HRESULT: 0x80070006 (E_HANDLE))

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[COMException (0x80070006): The handle is invalid. (Exception from HRESULT: 0x80070006 (E_HANDLE))]

[HttpException (0x80004005): An error occurred while communicating with the remote host. The error code is 0x80070006.]
System.Web.Hosting.IIS7WorkerRequest.RaiseCommunicationError(Int32 result, Boolean throwOnDisconnect) +2629371
System.Web.Hosting.IIS7WorkerRequest.FlushCore(Boolean keepConnected, Int32 numBodyFragments, IntPtr[] bodyFragments, Int32[] bodyFragmentLengths, Int32[] bodyFragmentTypes) +9625626
System.Web.Hosting.IIS7WorkerRequest.FlushCachedResponse(Boolean isFinal) +351
System.Web.HttpResponse.UpdateNativeResponse(Boolean sendHeaders) +431
System.Web.HttpRuntime.FinishRequestNotification(IIS7WorkerRequest wr, HttpContext context, RequestNotificationStatus& status) +116

Please Help me
Posted
Updated 10-Apr-16 20:15pm

add Response.Flush() at the end of the download code:

C#
//Response.End(); Will raise that error. this works well locally but not with IIS
 Response.Flush();//Won't get error with Flush() so use this Instead of End()
 
Share this answer
 
Check this link containing the solution for your issue. Hope it helps:
Invalid Handle[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900