Skip to Content
0
Former Member
Sep 15, 2011 at 12:31 AM

ExportToDisk COMException process cannot access the file because it is bein

393 Views

I got this intermittent exception at CrystalReport ExportToDisk method:

|Exception type = COMException

| Message = The process cannot access the file because it is being used by another process.

| Source = Analysis Server

| Stack = at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext)

| at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)

| at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)

| at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext)

| at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToDisk(ExportFormatType formatType, String fileName)

....

Version: CrystalReports for Visual Studio 2010 SP1, CrystalReport is created from a window service written in Visual Studio 2010.

Sometimes this exception occurred when ExportToDisk method is called to create the XLS format, right after it's called to create the pdf format. Sometimes the exception occrred when it's first trying create the pdf format.

I'd like to find out which file is blocked by which process when the exception occurred, and what's causing this exception.

Any hint/solution?

Thanks!