I am getting "The system cannot find the path specified" error when exporting from WebAPI Restful web service. My development environments are:
Windows 7 SP1 x64 Bit
Visual Studio 2013 Community
Crystal Report Support Pack 14 (v.13.0.14.1720)
DotNet 4.5.1
oracle instant client 11.2 (both x86 and x64)
Oracle 11g R2
I have seen a number of other posts, suggesting "The system cannot find the path specified" is related to the database connections not being set properly. To debug, I have done the following things to eliminate such possibility:
Remove all sub-report
Display only a single table with a single columns
Run the report as an executable program (And it works)
Since I was able to export the report in a exe program, I was thinking maybe crystal report is not compatible with WebAPI. To check, I've created a report connecting to MS SQL Server, and it works.
Given I have proved there is no database connections error, and crystal report can be generated from WebAPI (At least for MSSQL), I would really appreciate if someone can help me figure out what's the problem.
This is the source code of my attempts so far
https://www.dropbox.com/s/hyxuff79jwwar3q/WebApplication1.zip?dl=0
And this is the error exception
{
"Message" : "An error has occurred.",
"ExceptionMessage" : "The system cannot find the path specified.\r",
"ExceptionType" : "System.Runtime.InteropServices.COMException",
"StackTrace" : "
at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext)\r\n
at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)\r\n
at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)\r\n
at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext)\r\n
at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToDisk(ExportFormatType formatType, String fileName)\r\n
at reportManager.ReportManager.generateOracleReport() in c:\\Temp\\WebApplication1\\reportManager\\ReportManager.cs:line 31\r\n
at WebAPI.Controllers.DefaultController.getOracleReport() in c:\\Temp\\WebApplication1\\WebApplication1\\Controllers\\DefaultController.cs:line 16\r\n
at lambda_method(Closure , Object , Object[] )\r\n
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.b__9(Object instance, Object[] methodParameters)\r\n
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n
at System.Web.Http.Controllers.ApiControllerActionInvoker.d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n
at System.Web.Http.Controllers.ActionFilterResult.d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()"
}