首页 > 解决方案 > AWS Machine Learning Service in .NET Core

问题描述

I'd like to do a prediction in .NET Core on AWS Lambda using the Machine Learning service provided by AWS . I am getting this error. Does anyone have information about it?

https://prnt.sc/r1buou

Error   CS0029  Cannot implicitly convert type
'System.Threading.Tasks.Task<Amazon.MachineLearning.Model.Prediction>' to
'Amazon.MachineLearning.Model.Prediction'

标签: .netamazon-web-servicesmachine-learning.net-coreaws-lambda

解决方案


When you are building .NET Core Lambda functions you are using the .NET Standard version of the AWS SDK for .NET. The .NET Standard version only supports async operations due to that is what the underlying HttpClient supports in .NET Standard. So when you use the SDK in Lambda you will have to use .NET async/await pattern when making calls. The .NET Framework version, which you are probably more used to, supports sync as well as aync method.


推荐阅读