Amazon AWSClientFactory does not exists

匿名 (未验证) 提交于 2019-12-03 08:46:08

问题:

I created an empty .Net Core application and installed nuget packages for Both Amazon.Core and Amazon.S3.

Then I tried to use S3 to get an object but I'm stuck at the very first moment... Amazon.AWSClientFactory is nowhere to be found inside the assembly. Even with dotPeek I tried to search this factory method but I couldn't find it. Even the sample code from Amazon doesn't work.

Where I supposed to find this class ?

回答1:

Amazon.Core and Amazon.S3 are part of the AWS SDK for .NET v3. Per the AWS SDK for .NET Version 3 Migration Guide:

Change: AWSClientFactory is removed

Description: Use service client constructors instead of the AWSClientFactory

Or in other words, use IAmazonS3 and AmazonS3Client found in the Amazon.S3 nuget package:

using (IAmazonS3 client = new AmazonS3Client()) {   // do stuff } 

Further Reading



回答2:

Anthony is right. The AWSClientFactory is removed but, remember the NuGet packages are targeted or build for the specific platform.

You will still able to use the AWSClientFactory when you set the Target Framework to 4.5.2 and install the NuGet package and when you set the Target Framework 4.0 and install the NuGet Package you will not able to use AWSCLientFactory but, instead, you can use the AmazonS3Client and write a program to work with S3.

Perhaps, understanding the .net implementation support would clarify why you faced the issue. You need to understand "The higher the version, the more APIs are available to you." Here is the link that would help you to understand the same.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!