Getting error : Server cannot append header after HTTP headers have been sent on Importing reults to excel

Can’t reproduce this issue locally. On my Client’s production site which is hosted externally by himself, we are not able to export results into excel. We are getting below error in Application event log.


0200x8000000000000014788ApplicationDMZWS04C.BELRON.DMZ General Information ********************************************* Additional Info: ExceptionManager.MachineName: DMZWS04C ExceptionManager.TimeStamp: 15/07/2015 09:16:18 ExceptionManager.FullName: Microsoft.ApplicationBlocks.ExceptionManagement, Version=1.0.1679.40013, Culture=neutral, PublicKeyToken=null ExceptionManager.AppDomainName: /LM/W3SVC/1/ROOT/Bicep-10-130809197709380164 ExceptionManager.ThreadIdentity: 80 ExceptionManager.WindowsIdentity: NT AUTHORITY\NETWORK SERVICE 1) Exception Information ********************************************* Exception Type: System.Web.HttpException WebEventCode: 0 ErrorCode: -2147467259 Message: Server cannot append header after HTTP headers have been sent. Data: System.Collections.ListDictionaryInternal TargetSite: Void AppendHeader(System.String, System.String) HelpLink: NULL Source: System.Web HResult: -2147467259 StackTrace Information ********************************************* at System.Web.HttpResponse.AppendHeader(String name, String value) at Aspose.Cells.WorksheetCollection. š (HttpResponse , ContentDisposition , String , FileFormatType , Int64 , Boolean ) at Aspose.Cells.Workbook.Save(HttpResponse response, String fileName, ContentDisposition contentDisposition, SaveOptions saveOptions) at Protiviti.PAP.DataAccess.CoreDA.ExcelReportGeneratorDA.WriteToExcelFile(HttpResponse response, String fileName, String worksheetName, DataTable dt, List`1 columnsInfo, Boolean downloadAsCSV, Boolean richTextFormattingRemove, Boolean autoFitRowsRemove)

Also on Fiddler trace I got below error:
504 GATEWAY_TIMEOUT ()

Please suggest.





Hi,


Thanks for sharing the stack trace.

Well, we are not sure about your issue, please provide more details about your issue. We need a sample project (runnable) to reproduce the issue on our end. Also, as you also could not reproduce the issue on your local server or on other machine, so how could we evaluate your issue properly. We do not think the issue is with Aspose.Cells component by any means. To confirm this, please do not involve Aspose.Cells APIs to read and export Excel file using your own .NET code (e.g via HttpResponse and System.IO APIs) and you might find similar issue.

Thank you.