AWS Lambda 无服务器 .Net C# 应用程序错误

AWS Lamba Serverless .Net C# App Error

尝试使用 Visual Studio 模板在 AWS Lamba 中使用 Lamba 函数时出现错误。当我部署到 lamba 并尝试测试我的功能时,出现以下错误。我并没有真正改变项目的任何内容,只是按原样使用它。

我一直在努力找出问题所在,但无法解决。这真的是我第一次学习 Lamba 和 Serverless Architecture。有什么想法吗?

START RequestId: 65fd2b6c-f52e-11e6-ae87-4f4e1852036a Version: $LATEST
Incoming  requests to [Information] Microsoft.AspNetCore.Hosting.Internal.WebHost: Request starting   https://apigateway--   
Unknown error responding to request: NullReferenceException:
System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.AspNetCore.Routing.Internal.PathTokenizer.get_Count()
   at Microsoft.AspNetCore.Routing.Tree.TreeRouter.TreeEnumerator.MoveNext()
   at Microsoft.AspNetCore.Routing.Tree.TreeRouter.<RouteAsync>d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Routing.RouteCollection.<RouteAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Hosting.Internal.RequestServicesContainerMiddleware.<Invoke>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFunction.<ProcessRequest>d__15.MoveNext()
NullReferenceException:
System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.AspNetCore.Routing.Internal.PathTokenizer.get_Count()
   at Microsoft.AspNetCore.Routing.Tree.TreeRouter.TreeEnumerator.MoveNext()
   at Microsoft.AspNetCore.Routing.Tree.TreeRouter.<RouteAsync>d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Routing.RouteCollection.<RouteAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Hosting.Internal.RequestServicesContainerMiddleware.<Invoke>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFunction.<ProcessRequest>d__15.MoveNext()
[Information] Microsoft.AspNetCore.Hosting.Internal.WebHost: Request finished in 4680.1609ms 0  
END RequestId: 65fd2b6c-f52e-11e6-ae87-4f4e1852036a
REPORT RequestId: 65fd2b6c-f52e-11e6-ae87-4f4e1852036a  Duration: 7974.44 ms    Billed Duration: 8000 ms    Memory Size: 128 MB Max Memory Used: 46 MB  

遇到了同样的问题。在创建项目之前,您需要在 visual studio 中连接到 AWS 资源管理器。在 AWS 控制台门户中创建一个单独的帐户,然后重试。