我在 Syncfusion excel 文件下载的错误日志中收到此错误。它每天发生几次,但我自己从来没有遇到过这个错误。该文件确实存在于服务器上,并且大部分时间都可以正常工作,这使我很难调试。该网站位于 IIS 上的 .Net 4 中,并且从 GAC 引用了 syncfusion dll。Syncfusion 版本是 8.303.0.21。任何关于潜在原因的想法将不胜感激。
代码。
Private XlsIO As ExcelEngine
Private XlsWorkbook As IWorkbook
Dim str As String = Server.MapPath("Downloads/ExcelSpeedGen/excelfile.xls")
XlsIO = New ExcelEngine
XlsWorkbook = XlsIO.Excel.Workbooks.Open(str)
XlsRSheet = XlsWorkbook.Worksheets("raw data")
XlsRSheet.ImportDataTable(datatable, False, 2, 1, True)
XlsWorkbook.SaveAs("Excel.xls", ExcelSaveType.SaveAsXLS, Response, Syncfusion.XlsIO.ExcelDownloadType.PromptDialog)
XlsWorkbook.Close()
错误。
System.Web.HttpException (0x80004005): Exception of type 'System.Web.HttpException' was
thrown. ---> System.Web.HttpUnhandledException (0x80004005): Exception of type
'System.Web.HttpUnhandledException' was thrown. ---> System.IO.FileNotFoundException: File
D:\inetpub\Secure\mywebsite\Downloads\ExcelSpeedGen\excelfile.xls could not be found. Please
verify the file path. at Syncfusion.XlsIO.Implementation.Collections.WorkbooksCollection.Open
(String fileName, ExcelOpenType openType, ExcelVersion version, ExcelParseOptions options) at
Syncfusion.XlsIO.Implementation.Collections.WorkbooksCollection.Open(String filename) at
Default.form1_Load(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean
includeStagesAfterAsyncPoint) at System.Web.UI.Page.HandleError(Exception e) at
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean
includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint,
Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at
System.Web.Util.AspCompatApplicationStep.System.Web.HttpApplication.IExecutionStep.Execute() at
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) at
System.Web.HttpAsyncResult.End() at ASP.ideasplusbaseline_aspx.EndProcessRequest(IAsyncResult ar) at
System.Web.HttpApplication.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar)