c# - .NET v 5.0 缺少 Amazon S3 SelectObjectContent 支持?

标签 c# .net amazon-s3 .net-core amazon-s3-select

我发现 .NET v4.8 和 .NET v5.0/.NETCore v3.1 之间的 AWS SDK 似乎发生了重大变化。按照 official blog 中的教程进行操作,我发现我无法使用同步方法SelectObjectContent编译/运行.NET v5.0或.NETCore v3.1中的示例。 AWS SDK API 很清楚这是一个可调用方法,但我的 Visual Studio/Rider 发现它是作为内部方法实现的,因此我无法干净地访问它。事实上,我什至无法编译。

但是,经过详尽的尝试后,我意识到回到 .NET Framework v4.8,即使使用相同的 AWS SDK nuget (v3.7.0.21),它也能像宣传的那样工作。

是否有访问该功能的首选方法,或者是否意外引入了未记录的重大更改?我不确定如何区分这是 .NET Framework 还是 AWS SDK 的问题,因此我不确定在哪里报告该问题。代码来自 AWS,但这取决于 .NET Framework 版本。

最佳答案

同步方法已消失,因为它旨在用于 .NET/.NET Core 项目和相应的 SDK。

在AWS工作的GitHub用户normj stated in a thread :

The reason the .NET Core version only has async is because the underlying http client available in .NET Core only supports async operations. We debated about keeping the sync methods in the .NET Core version and have them just call the async versions and then block. The problem with that is the SDK would not be following best practice for the platform and more importantly it could mask a potential performance problem.

因此,您遵循的指南不一定是错误的,但可能会有点误导 - 您只需使用您可以使用的指南即可。

此外,尽管使用相同版本的 AWSSDK,但根据您的项目所针对的框架,它将引用包的 lib 文件夹中找到的不同 DLL,这解释了为什么 . NET Framework 项目中该方法可用,但对于 .NET Core/.NET 项目则不可用。 Visual Studio 解决方案资源管理器中 DLL 的属性也将指示这一点(请注意 Path 属性)。

关于c# - .NET v 5.0 缺少 Amazon S3 SelectObjectContent 支持?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67524503/

相关文章:

amazon-web-services - Amazon AWS CloudFront 声称不存在这样的存储桶

java - Amazon S3 AWS SDK [Java] - 分段上传如何在http响应中获取自定义 header ?

c# - SQL Server Decimal - 为什么我的十进制值只捕获小数点后两位小数?是的,它是小数(18,5)

.net - 如何设置 .Net 应用程序以使用 firebird Entity Framework 提供程序(对于嵌入式数据库)

c# - .Net 的免费/开源应用程序换肤解决方案?

.net - Ansicon 和 cucumber : 'Ruby interpreter (CUI) 1.9.3p194 [1386-mingw] has stopped working'

c# - MVC路由静态文件

c# - 通过部分匹配名称来查找多个控件

c# - 并发冲突 : the UpdateCommand affected 0 of the expected 1 records

python Boto3 S3 : List only current directory file ignoring subdirectory files