C# Alexa服务模拟器解析错误
我正在尝试使用VS2015和C# Alexa服务模拟器解析错误,c#,aws-lambda,alexa,alexa-skills-kit,alexa-voice-service,C#,Aws Lambda,Alexa,Alexa Skills Kit,Alexa Voice Service,我正在尝试使用VS2015和Alexa.Netnuget软件包向Alexa Echo Dot添加自定义技能。 我能够将lambda函数上传到Amazon Webservice。我能看到这些技能。 然而,当我尝试使用服务模拟器测试lambda函数时,我得到了下面的错误 “无法调用远程终结点,或者它返回的响应无效。” “第1行的分析错误: 远程终结点^1应为'STRING',NUMBER',NULL…” 我不确定这里到底缺少什么。详情如下 Lambda请求 { "session": {
Alexa.Net
nuget软件包向Alexa Echo Dot添加自定义技能。
我能够将lambda函数上传到Amazon Webservice。我能看到这些技能。
然而,当我尝试使用服务模拟器测试lambda函数时,我得到了下面的错误
“无法调用远程终结点,或者它返回的响应无效。”“第1行的分析错误: 远程终结点^1应为'STRING',NUMBER',NULL…” 我不确定这里到底缺少什么。详情如下 Lambda请求
{
"session": {
"sessionId": "SessionId.23409e06-265b-4704-a288-8d5329a68a68",
"application": {
"applicationId": "amzn1.ask.skill.55a9cca9-02dc-4780-a55c-c1d0dee6b8c6"
},
"attributes": {},
"user": {
"userId": "amzn1.ask.account.AHPIWHCHA22Z3WAJGS2ABA3MQ3PTKB4HOMJIBBDILIBPWTSAAOELN45D4PIV3U75IOBDHNGJQ36OSUYK43VQKYSQFIM2OHHOORSDWM2HMLWKINLCLKU7R3SNONWM7YPWSMR5XGN6XKVZGBG4NFHDQXACZLVK57MXUOIYYV6RLLVACBMMSFPVDINMO3QKQUZVZMVR73KTCEYTCRY"
},
"new": true
},
"request": {
"type": "IntentRequest",
"requestId": "EdwRequestId.082b6e56-29d4-4eed-a353-e24890cfbefa",
"locale": "en-US",
"timestamp": "2017-07-11T12:19:27Z",
"intent": {
"name": "CountryInfoIntent",
"slots": {
"Country": {
"name": "Country",
"value": "France"
}
}
}
},
"version": "1.0"
}
函数处理程序
public SkillResponse FunctionHandler(SkillRequest input, ILambdaContext context)
{
var requestType = input.GetRequestType();
if (requestType == typeof(IntentRequest))
{
return MakeSkillResponse(
$"Hello Infotec! This is the first response from your Alexa skill using c sharp.",
true);
}
else
{
return MakeSkillResponse(
$"I don't know how to handle this intent. Please say something like Alexa, ask {INVOCATION_NAME} about Canada.",
true);
}
}
private SkillResponse MakeSkillResponse(string outputSpeech, bool shouldEndSession, string repromptText = "Just say, tell me about Canada to learn more. To exit, say, exit.")
{
var response = new ResponseBody
{
ShouldEndSession = shouldEndSession,
OutputSpeech = new PlainTextOutputSpeech { Text = outputSpeech }
};
if (repromptText != null)
{
response.Reprompt = new Reprompt() { OutputSpeech = new PlainTextOutputSpeech() { Text = repromptText } };
}
var skillResponse = new SkillResponse
{
Response = response,
Version = "1.0"
};
return skillResponse;
}
这是Alexa.NETNuget包中的一个bug。这已经在最新的软件包中修复