部署到AWS Lambda时,ClosedXML引发异常

时间:2018-08-06 07:41:45

标签: c# asp.net-core aws-lambda closedxml

我有一个AWS lambda,可从excel文件读取数据。我已将ClosedXml v 0.93.0.net core 2一起使用。

该函数在localhost上运行时可按预期工作,但会出现错误:

  

{“错误”:“'ClosedXML.Excel.XLHelper'的类型初始值设定项引发了异常。”}

在AWS Lambda上部署时。

已更新堆栈跟踪:

  

在ClosedXML.Excel.XLWorksheet.Ranges(字符串范围)\ n
      at ClosedXML.Excel.XLWorkbook.LoadSheetViews(SheetViews sheetViews,XLWorksheet ws)\ n
      在ClosedXML.Excel.XLWorkbook.LoadSpreadsheetDocument(SpreadsheetDocument dSpreadsheet)\ n
      at ClosedXML.Excel.XLWorkbook.LoadSheets(Stream stream)\ n
      在Business.Services.ImportService.ValidateExcel(Stream excelData,Guid clientId)处       在Business \ Services \ ImportService.cs:第38行\ n
      在Business.Controllers.CommonDataBusinessController.Import(IFormCollection文件)       在Business \ Controllers \ CommonDataBusinessController.cs:第61行\ n
      在lambda_method(Closure,Object,Object [])\ n
      在Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(对象target,Object []参数)\ n
      在Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__12.MoveNext()\ n ---从上一个引发异常的位置开始的堆栈结束跟踪--- \ n
      在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\ n
      在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ n
      在Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__10.MoveNext()\ n ---从上一个引发异常的位置开始的堆栈结束跟踪--- \ n
      在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\ n
      在Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext上下文)\ n
      at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(状态和下一个,范围和范围,对象和状态,布尔值和已完成)\ n
      在Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__14.MoveNext()\ n ---从上一个引发异常的位置开始的堆栈结束跟踪--- \ n
      在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ n
      在Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d__22.MoveNext()\ n ---从上一个引发异常的位置开始的堆栈结束跟踪--- \ n
      在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\ n在Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)\ n
      at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(状态和下一个,范围和范围,对象和状态,布尔值和已完成)\ n
      在Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d__17.MoveNext()\ n ---从上一个引发异常的位置开始的堆栈结束跟踪--- \ n
      在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ n
      在Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d__15.MoveNext()\ n ---从上一个引发异常的位置开始的堆栈结束跟踪--- \ n
      在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ n
      在Microsoft.AspNetCore.Builder.RouterMiddleware.d__4.MoveNext()\ n ---从上一个引发异常的位置开始的堆栈结束跟踪--- \ n
      在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ n
      在Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.d__6.MoveNext()\ n ---从上一个引发异常的位置开始的堆栈结束跟踪--- \ n
      在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ n
      在Business.ErrorHandlingMiddleware.d__3.MoveNext()中       D:Business \ ErrorHandlingMiddleware.cs:第28行

0 个答案:

没有答案