use*_*165 5 .net-core aws-lambda
我有要部署到 AWS Lambda 的 .Net Core2.1 代码。我不想使用 Visual Studio 将我的代码发布到 Lambda 我想使用 .net core cli 发布它。我运行命令
dotnet 发布 /p:GenerateRuntimeConfigurationFiles=true
我压缩了我的部署并将其加载到 Lambda AWS 控制台中。但是当我运行 lambda 时,我收到以下错误:
{
"errorType": "LambdaException",
"errorMessage": "Could not find the required 'RSSFeedStartService.deps.json'. This file should be present at the root of the deployment package."
}
Run Code Online (Sandbox Code Playgroud)
我可以看到它RSSFeedStartService.deps.json在部署包中。它是我压缩部署的一部分 为什么它一直抱怨它不存在?
就我而言,我错误地压缩了包裹。实际的发布目录包含在 zip 中,这解释了错误的“此文件应位于部署包的根目录”部分。
这就是最终的工作结果(假设你使用的是 Linux/Mac):
dotnet publish -o publish
cd publish
zip -r ../publish.zip *
Run Code Online (Sandbox Code Playgroud)
publish.zip然后我用 Lambda 控制台上传。
(提示:运行unzip -l publish.zip以查看 zip 的内容。它不应包含在publish/文件之前。)
| 归档时间: |
|
| 查看次数: |
6368 次 |
| 最近记录: |