用的是示例中的代码
class Program
{
static void Main(string[] args)
{
Cloud cloud = new Cloud().SetHooks().UseLog();
cloud.UseFunction();
cloud.Start(args);
}
}
public class HelloSample
{
[EngineFunction("Hello")]
public static string Hello([EngineFunctionParameter("text")]string text)
{
return $"Hello, {text}";
}
}
前端
var paramsJson = {
text: "夏洛特烦恼"
};
this.AV.Cloud.run('Hello', paramsJson).then(function (data) {
// 处理结果
console.log("云函数测试:"+data);
}, function (err) {
console.log("云函数错误:"+err);
// 处理报错
});
云函数错误:TypeError: Cannot read property 'result' of null
看应用日志
[2020-02-18T06:41:55.911044869Z][instance:web1] 200 {"result":"Hello, 夏洛特烦恼"} 是有这条的