C#Test中的AWS Lambda函数无法正常工作

时间:2017-04-17 04:29:03

标签: amazon-web-services

我想用C#创建一个Hello-World Aws Lambda函数,使用vs2015 AWSToolsAndSDKForNet_sdk-3.3.69.0_ps-3.3.67.0_tk-1.11.6.2

public class Function
{
    [LambdaSerializer(typeof(JsonSerializer))]
    public model FunctionHandler(string input)
    {
        model result = new model();
        result.Input = "hello-AWS-Lambda!";
        return result;
    }
}

public class model
{
    [JsonProperty("input")]
    public string Input { get; set; }
}

当我发布到Aws并测试我的功能时!我收到了一条错误消息:

{
  "errorType": "JsonReaderException",
  "errorMessage": "Unexpected character encountered while parsing value: {. Path '', line 1, position 1.",
  "stackTrace": [
    "at Newtonsoft.Json.JsonTextReader.ReadStringValue(ReadType readType)",
    "at Newtonsoft.Json.JsonTextReader.ReadAsString()",
    "at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader reader, JsonContract contract, Boolean hasConverter)",
    "at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)",
    "at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)",
    "at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)",
    "at lambda_method(Closure , Stream , Stream , ContextInfo )"
  ]
}

我是否失去了任何步骤或导致此错误的事情? 感谢您抽出时间阅读我的问题

0 个答案:

没有答案