gpt4 book ai didi

c# - Azure 耐用功能错误 "No activity functions are currently registered!"

转载 作者:行者123 更新时间:2023-12-02 07:25:39 24 4
gpt4 key购买 nike

完整消息:

Function 'Function1 (Orchestrator)' failed with an error. 
Reason: System.ArgumentException:
The function 'Function1_GetData' doesn't exist,
is disabled, or is not an activity function.
Additional info: No activity functions are currently registered!
[FunctionName("Function1")]
public static async Task<List<string>> RunOrchestrator([OrchestrationTrigger] DurableOrchestrationContext context) {
var outputs = new List<string>();

using (var efContext = new DbContext()) {
foreach (var s in efContext.Table) {
var x= await context.CallActivityAsync<bool>("Function2_GetSummonerChanges", s.Id);
outputs.Add(x.ToString());
}
}
context.ContinueAsNew(null);
return outputs;
}

[FunctionName("Function1_GetData")]
public static bool GetData(long Id) {
return true;
}

最佳答案

您没有事件函数“Function2_GetSummonerChanges”的定义

可能是这样的

[FunctionName("Function2_GetSummonerChanges")]
public static int MyActivityFunction([ActivityTrigger] int id, ILogger log)
{
// your logic
}

查看以下示例和链接,了解有关耐用功能构建 block 的更多信息

https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-create-first-csharp

using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Logging;

namespace FunctionApp28
{
public static class Function1
{
[FunctionName("Function1")]
public static async Task<List<string>> RunOrchestrator(
[OrchestrationTrigger] DurableOrchestrationContext context)
{
var outputs = new List<string>();

// Replace "hello" with the name of your Durable Activity Function.
outputs.Add(await context.CallActivityAsync<string>("Function1_Hello", "Tokyo"));
outputs.Add(await context.CallActivityAsync<string>("Function1_Hello", "Seattle"));
outputs.Add(await context.CallActivityAsync<string>("Function1_Hello", "London"));

// returns ["Hello Tokyo!", "Hello Seattle!", "Hello London!"]
return outputs;
}

[FunctionName("Function1_Hello")]
public static string SayHello([ActivityTrigger] string name, ILogger log)
{
log.LogInformation($"Saying hello to {name}.");
return $"Hello {name}!";
}

[FunctionName("Function1_HttpStart")]
public static async Task<HttpResponseMessage> HttpStart(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post")]HttpRequestMessage req,
[OrchestrationClient]DurableOrchestrationClient starter,
ILogger log)
{
// Function input comes from the request content.
string instanceId = await starter.StartNewAsync("Function1", null);

log.LogInformation($"Started orchestration with ID = '{instanceId}'.");

return starter.CreateCheckStatusResponse(req, instanceId);
}
}
}

关于c# - Azure 耐用功能错误 "No activity functions are currently registered!",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55056389/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com