问这样一个基本问题我觉得自己像个白痴,但这里……我第一次在 C# 中尝试 AWS Lambda,并根据文档:
Anything written to standard out or standard error - using Console.Write or a similar method - will be logged in CloudWatch Logs.
好的,执行后我得到以下运行时异常:
Unable to load DLL 'api-ms-win-core-processenvironment-l1-1-0.dll': The specified module could not be found.
(Exception from HRESULT: 0x8007007E): DllNotFoundException
at Interop.mincore.GetStdHandle(Int32 nStdHandle)
at System.ConsolePal.GetStandardFile(Int32 handleType, FileAccess access)
at System.Console.<>c.<get_Out>b__25_0()
at System.Console.EnsureInitialized[T](T& field, Func`1 initializer)
at System.Console.WriteLine(String value)
我的问题是,我应该如何/在哪里添加它要求的引用?答案似乎并不明显。
最佳答案
作为 Console.Write
或 Console.WriteLine
的替代方法,您可以在静态 Amazon 上使用
类。Log
方法。 Lambda.Core.LambdaLogger
private void DoSomething() {
LambdaLogger.Log("Log message");
}
可以在此处找到更多信息:http://docs.aws.amazon.com/lambda/latest/dg/dotnet-logging.html
关于c# - 将 C# Console.Write* 与 AWS Lambda 结合使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42183485/