【发布时间】:2018-03-06 19:43:49
【问题描述】:
我创建了一个在本地模式下完美运行的 aws 函数,但是在 aws lambda 中执行时,我得到了:
进程在完成请求之前退出
该函数使用 Dapper 连接到 RDS SQL 连接。我检查了安全组,入站/出站规则是正确的。
LambdaLogger.Log($"Listando doacao em visita");
using (SqlConnection conexao = new SqlConnection(_connectionString))
{
LambdaLogger.Log($"Conexao aberta");
var weekDay = (int)DateTime.Now.DayOfWeek;
var stringSql = $@"{_query}
WHERE
p.status = {(int)StatusPedido.DoacaoEmVisita} and
p.datainclusao <= Getdate() - 7
";
LambdaLogger.Log($"Query gerada");
//the function exited on this line
var query = conexao.Query<AlertaDisponibilidadeERetiradaDTO, EnderecoDTO, AlertaDisponibilidadeERetiradaDTO>(
stringSql
, (pedido, endereco) =>
{
pedido.Endereco = endereco;
return pedido;
}, splitOn: "IdEndereco");
LambdaLogger.Log($"Query executada.");
return query;
}
我已经用 try/catch 包装了代码,以记录异常发生的原因,但不幸的是,该函数立即存在,我不知道为什么。
【问题讨论】:
标签: c# amazon-web-services lambda aws-lambda