- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
以下带有 Confluent.Kafka
nuget 包的 .Net core 2.1 lambda 应用程序是在 Visual Studio 中使用适用于 Visual Studio 2017 的 AWS 工具包创建的。但是,以下代码
using (var producer = new Producer<Null, string>(config, null, new StringSerializer(Encoding.UTF8)))
{
await producer.ProduceAsync("mytopic", null, msg);
}
在 CloudWatch 中出现以下错误
One or more errors occurred. (Failed to load the librdkafka native library.): AggregateExceptionat System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)at lambda_method(Closure , Stream , Stream , LambdaContextInternal )at Confluent.Kafka.Impl.LibRdKafka.Initialize(String userSpecifiedPath)at Confluent.Kafka.Producer..ctor(IEnumerable`1 config, Boolean manualPoll, Boolean disableDeliveryReports)at Confluent.Kafka.Producer`2..ctor(IEnumerable`1 config, ISerializer`1 keySerializer, ISerializer`1 valueSerializer, Boolean manualPoll, Boolean disableDeliveryReports)at StratsLambda.Function.FunctionHandler(S3Event evnt, ILambdaContext context) in C:\work\.....
Here is the AWS toolkit publishing messages:
Executing publish commandDeleted previous publish folder... invoking 'dotnet publish', working folder 'C:\work\....\bin\Release\netcoreapp2.1\publish'... publish: Microsoft (R) Build Engine version 15.7.179.6572 for .NET Core... publish: Copyright (C) Microsoft Corporation. All rights reserved.... publish: Restore completed in 31.3 ms for C:\work\....\StratsLambda.csproj.... publish: Restore completed in 62.87 ms for C:\work\....\StratsLambda.csproj.... publish: StratsLambda -> C:\work\....\bin\Release\netcoreapp2.1\linux-x64\StratsLambda.dll... publish: StratsLambda -> C:\work\....\bin\Release\netcoreapp2.1\publish\Zipping publish folder C:\work\....\bin\Release\netcoreapp2.1\publish to C:\work\....\bin\Release\netcoreapp2.1\StratsLambda.zip... zipping: Amazon.Lambda.Core.dll... zipping: Amazon.Lambda.S3Events.dll... zipping: Amazon.Lambda.Serialization.Json.dll... zipping: AWSSDK.CloudWatchLogs.dll... zipping: AWSSDK.Core.dll... zipping: AWSSDK.S3.dll... zipping: Confluent.Kafka.dll... zipping: debian9-librdkafka.so... zipping: librdkafka.so... zipping: Newtonsoft.Json.dll... zipping: Serilog.dll... zipping: Serilog.Sinks.AwsCloudWatch.dll... zipping: Serilog.Sinks.PeriodicBatching.dll... zipping: StratsLambda.deps.json... zipping: StratsLambda.dll... zipping: StratsLambda.pdb... zipping: StratsLambda.runtimeconfig.json... zipping: System.Runtime.CompilerServices.Unsafe.dllUpdating code for existing function savstratsConfig settings saved to C:\work\....\aws-lambda-tools-defaults.json
I created a unit test function to test the Kafka producing and it can send message to my Kafka successfully. And the folder ...\bin\Debug\netcoreapp2.1
has only the following files.
Name Length---- ------StratsLambda.deps.json 58489StratsLambda.dll 12800StratsLambda.pdb 1908StratsLambda.runtimeconfig.dev.json 238StratsLambda.runtimeconfig.json 154
Update:The file StratsLambda.deps.json has the following section,
"librdkafka.redist/0.11.5": {
"native": {
"runtimes/linux-x64/native/centos7-librdkafka.so": {
"fileVersion": "0.0.0.0"
},
"runtimes/linux-x64/native/debian9-librdkafka.so": {
"fileVersion": "0.0.0.0"
},
"runtimes/linux-x64/native/librdkafka.so": {
"fileVersion": "0.0.0.0"
}
}
},
我还尝试在 zip 文件中创建文件夹 runtimes/linux-x64/native
和电影文件。
但是,还是报错
An assembly specified in the application dependencies manifest (MyApp.deps.json) was not found:
package: 'librdkafka.redist', version: '0.11.5'
path: 'runtimes/linux-x64/native/centos7-librdkafka.so'
START RequestId: 73e39d0b-8ec8-11e8-8597-.... Version: $LATEST
Failed to execute the Lambda function. The dotnet CLI failed to start with the provided deployment package. Please check CloudWatch logs for this Lambda function to get detailed information about this failure.: LambdaException
最佳答案
正如它所提到的,因为这些库只是运行时的一部分,并且需要特定的运行时才能在主机上可用。
我建议不要在您的源代码中包含运行时目录,它可能有效但看起来很难看。
我使用了以下解决方案。
已添加 <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
项目文件中的标记。下面的示例;
或者,您也可以添加 -p:GenerateRuntimeConfigurationFiles=true
作为 dotnet publish
的参数在您的构建服务器上执行命令。
上面应该输出runtime
你的目录bin
(或输出)目录。如果您使用 nuget 构建包,那么您还需要确保您的 *.nuspec
(如果这是用于打包的)还包括 nuget 包中的目录。下面的示例包括包中的所有文件和所有目录。
关于c# - AWS Toolkit for Visual Studio 错误? AWS C# lambda 无法加载Kafka 的librdkafka 原生库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51405466/
我想根据我使用的 visual studio 版本编译不同的东西,比如 #if VISUAL_STUDIO_VERSION > 2015 eventH?.Invoke(this, EventArgs.
在 Visual Studio 2010 中调试并将鼠标悬停在变量名称上时,我可以选择使用 3 种不同的内置可视化工具:文本、XML 和 HTML。 这是我所指的示例: 由于我越来越多地使用基于 JS
我将可视化编程语言理解为允许程序员在屏幕上操作图形(而不是文本)对象以构建功能的语言。 我在 C#、VB 等中看到的最接近的东西是 RAD 控件,但这只是组成 UI 和最简单的功能——甚至与语言本身无
我目前正在使用 Visual Studio 2015 来编程 ASP.NET Core 应用程序。我对安装 Visual Studio 2017 有以下疑问: 什么被认为是最佳实践和/或最干净的方法?
尝试从扩展和更新获取 Visual Studio 扩展时,出现以下错误:- 向 visualstudiogallery.msdn.microsoft.com/Services/VStudio/Exte
我已经开发了Windows服务,并且该服务正在我的帐户下在本地计算机上运行。当我尝试通过在Visual Studio 2008中将其作为一个过程附加该服务来调试该服务时,我得到“无法附加到该过程。 V
作为标准安装的一部分,Visual Studio Code 带有一个名为“Monokai Dimmed”的颜色主题。 有没有办法将它移植到 Visual Studio 2015?我检查了社区主题( h
Visual Studio Community Edition是否可以使用Visual Studio Online帐户上的存储库? 我一直为包含在Online帐户中的Visual Studio Onl
我正在使用文本可视化工具在 Visual Studio 中调试字符串变量。然而,似乎字符串中间的大部分不见了。这背后的原因是什么? 最佳答案 Visual Studio 中的 Text Visuali
我正在开始一个涉及使用多个 SDK 的新项目,包括: 英特尔凌动开发者 SDK 文本转语音 SDK(建议?) 某种网络摄像头和增强现实支持(建议?) 我目前有 2008,但我也可以安装 2010。是否
我想知道,如果我发送一个解决方案文件夹(它是用 visual studio C# 编写的),您可以在 visual studio for mac 中打开解决方案吗? 在visual studio 20
有没有办法在 Visual Studio Code 和 Visual Studio 中设置相同的快捷方式(而不必每次都手动更改它们)? 例如,我在 Visual Studio Code 中经常使用 A
我无法启用 实时可视化树 在 Visual Studio 2017 用于 UWP 应用程序 (C#)。这个工具在 VS2015 上工作,但在 VS2017 中从来没有为我工作过。它对我的 WPF 项目
我刚开始了解 Visual Studio Code。我想知道,我可以将 Visual Studio 替换为所有 .NET 开发相关的工作吗? 我可以节省 Visual Studio 许可的成本吗? V
我安装了具有有效许可证(Visual Studio 订阅)的 Visual Studio 2019 企业版(VS 2019 16.1.4),它运行良好。 突然之间,当我尝试打开项目或项目中的任何文件时
Visual Studio 2015 Pro 提供以下 错误 : error BC36716: Visual Basic 9.0 does not support implicit line cont
我正在我的 PC 中使用 .net Framework 2.0 和 Visual C#(Microsoft Visual Studio 2008)开发 Windows 应用程序。 完成我的项目后,我必
有什么方法可以在启动 VS 时禁用 VA X 并仅在需要时将其重新打开?因为它会导致一些滞后。我似乎在 VS 的选项或 VA 的选项中都找不到该选项。 最佳答案 持shift在 Visual Stud
我可以将 Visual Studio 命令提示符 与免费的 Visual C# Express 一起使用吗? Visual Studio 命令提示符 被引用 here : Run 'Visual St
这很容易成为 Visual Studio 历史上最烦人的“功能”之一,我不明白它为什么存在 -- 曾经 . 为什么 CodePlex 项目需要关心我使用的是什么版本的 Visual Studio? 在
我是一名优秀的程序员,十分优秀!