代码在.net控制台应用程序中工作,但不是在aws lambda中

//get local time DateTime localDateTime = DateTime.UtcNow.AddHours(Convert.ToDouble(_UTCOffet)); AmazonDynamoDBClient _dbClient = new AmazonDynamoDBClient( new AmazonDynamoDBConfig { RegionEndpoint = RegionEndpoint.APSoutheast2 }); LambdaLogger.Log("Atempting to get ASG min value from DynamoDB - " + _DynamoDBName + " at AEST Hour - " + localDateTime.Hour.ToString()); // Define item hash-key to be string value "Mark Twain" AttributeValue hashKey = new AttributeValue { S = localDateTime.Hour.ToString() }; // Define query condition to search for range-keys that begin with the string "The Adventures" Condition condition = new Condition { ComparisonOperator = "EQ", AttributeValueList = new List<AttributeValue> { new AttributeValue { S = localDateTime.Hour.ToString() } } }; // Create the key conditions from hashKey and condition Dictionary<string, Condition> keyConditions = new Dictionary<string, Condition> 

{

{“ID”,新条件{ComparisonOperator =“EQ”,AttributeValueList = new List {hashKey}}} //范围键条件{“HrOfTheDay”,condition}};

  // Define marker variable Dictionary<string, AttributeValue> startKey = null; // Create Query request QueryRequest request = new QueryRequest { TableName = _DynamoDBName, ExclusiveStartKey = startKey, KeyConditions = keyConditions }; // Issue request var result = _dbClient.QueryAsync(request); // View all returned items List<Dictionary<string, AttributeValue>> items = result.Result.Items; if (items.Count > 0) return items[0]; else return null; 

在下面的行失败

//发出请求var result = _dbClient.QueryAsync(request);

错误:

 Response recieved from dynamo DB - Amazon.Runtime.Internal.Util.AlwaysSendList`1[System.Collections.Generic.Dictionary`2[System.String,Amazon.DynamoDBv2.Model.AttributeValue]] 

06:22:15发生一个或多个错误。 (发生了一个或多个错误(无法强制types为“Amazon.DynamoDBv2.Model.AttributeValue”的对象types为“System.IConvertible”。)):AggregateException at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)at System.Threading.Tasks.Task 1.GetResultCore(Boolean waitCompletionNotification) at lambda_method(Closure , Stream , One or more errors occurred. (One or more errors occurred. (Unable to cast object of type 'Amazon.DynamoDBv2.Model.AttributeValue' to type 'System.IConvertible'.)): AggregateException at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task (布尔值为includeTaskCanceledExceptions)处的AggregateException。lambda_method(Closure,Stream,Stream, ContextInfo)