I'm using .NET Core and have written an Azure function. I get this exception at runtime, thrown by the client of the orchestrator:
> Grpc.Core.RpcException: 'Status(StatusCode="Internal", Detail="Failed to start instance with ID 123e757c8a0f7480986a27525f8877aeb.
>
> Inner exception message:
> The function 'ABCOrchestrator' doesn't exist, is disabled, or is not an orchestrator function. Additional info: No orchestrator functions are currently registered!.")'
This is my code:
[Function(nameof(ClientABCOrchestrator))]
public async Task<string> Run(
[BlobTrigger("someContainer/{someFileName}", Connection = "connString")] BlobClient clientBlob,
string someFileName,
[DurableClient] DurableTaskClient client)
{
var instanceId = "";
try
{
instanceId = await client.ScheduleNewOrchestrationInstanceAsync(nameof(DocumentProcessingOrchestrator), dmsFileUploaded);
}
catch (Exception ex)
{
throw;
}
}
Orchestrator code:
namespace myNS
{
[DurableTask(nameof(ABCOrchestrator ))]
public class ABCOrchestrator : TaskOrchestrator<string, string>
{
public ABCOrchestrator () {}
public async override Task<string> RunAsync(TaskOrchestrationContext context, string input)
{
// Calling the class based task activity....
var result = await context.CallActivityAsync<bool>(nameof(SomerActivity), input);
}
}
}
Referenced packages:
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="2.0.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Core" Version="2.0.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.CosmosDB" Version="4.12.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.3.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="2.0.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage.Blobs" Version="6.6.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Timer" Version="4.3.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="2.0.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk.Analyzers" Version="1.2.2" />
<PackageReference Include="Microsoft.Extensions.Azure" Version="1.10.0" />
<PackageReference Include="Microsoft.DurableTask.Generators" Version="1.0.0-preview.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.DurableTask" Version="1.2.2" />
Are the class-based Orchestrator and activity not supported in .NET Core Azure functions anymore?
These were working before but it got busted after the packages were updated.
Orchestrator client would successfully invoke the Orchestrator. And it was, before packages were updated.
I'm using .NET Core and have written an Azure function. I get this exception at runtime, thrown by the client of the orchestrator:
> Grpc.Core.RpcException: 'Status(StatusCode="Internal", Detail="Failed to start instance with ID 123e757c8a0f7480986a27525f8877aeb.
>
> Inner exception message:
> The function 'ABCOrchestrator' doesn't exist, is disabled, or is not an orchestrator function. Additional info: No orchestrator functions are currently registered!.")'
This is my code:
[Function(nameof(ClientABCOrchestrator))]
public async Task<string> Run(
[BlobTrigger("someContainer/{someFileName}", Connection = "connString")] BlobClient clientBlob,
string someFileName,
[DurableClient] DurableTaskClient client)
{
var instanceId = "";
try
{
instanceId = await client.ScheduleNewOrchestrationInstanceAsync(nameof(DocumentProcessingOrchestrator), dmsFileUploaded);
}
catch (Exception ex)
{
throw;
}
}
Orchestrator code:
namespace myNS
{
[DurableTask(nameof(ABCOrchestrator ))]
public class ABCOrchestrator : TaskOrchestrator<string, string>
{
public ABCOrchestrator () {}
public async override Task<string> RunAsync(TaskOrchestrationContext context, string input)
{
// Calling the class based task activity....
var result = await context.CallActivityAsync<bool>(nameof(SomerActivity), input);
}
}
}
Referenced packages:
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="2.0.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Core" Version="2.0.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.CosmosDB" Version="4.12.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.3.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="2.0.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage.Blobs" Version="6.6.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Timer" Version="4.3.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="2.0.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk.Analyzers" Version="1.2.2" />
<PackageReference Include="Microsoft.Extensions.Azure" Version="1.10.0" />
<PackageReference Include="Microsoft.DurableTask.Generators" Version="1.0.0-preview.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.DurableTask" Version="1.2.2" />
Are the class-based Orchestrator and activity not supported in .NET Core Azure functions anymore?
These were working before but it got busted after the packages were updated.
Orchestrator client would successfully invoke the Orchestrator. And it was, before packages were updated.
Share Improve this question edited Feb 22 at 4:37 Muhammad Junaid Khalid 1,2204 gold badges24 silver badges43 bronze badges asked Feb 21 at 2:41 amit jhatakiaamit jhatakia 132 bronze badges 2- Which .NET version are you using? – Pravallika KV Commented Feb 21 at 3:44
- Provide your complete code if possible. – Pravallika KV Commented Feb 21 at 6:56
1 Answer
Reset to default 1To fix the error, add FunctionsEnableWorkerIndexing
and FunctionsEnableExecutorSourceGen
in .csproj:
<FunctionsEnableWorkerIndexing>false</FunctionsEnableWorkerIndexing>
<FunctionsEnableExecutorSourceGen>false</FunctionsEnableExecutorSourceGen>
Also install Microsoft.DurableTask.Generators
package.
I could run Class-based Orchestrators in .NET 8.0 isolated Azure functions.
Function code:
public static class Function1
{
[Function("Function1_HttpStart")]
public static async Task Run(
[BlobTrigger("container1/{someFileName}", Connection = "connString")] BlobClient clientBlob,
string someFileName,
[DurableClient] DurableTaskClient client,
ILogger log)
{
var instanceId = "";
try
{
var input = "FileUploaded";
instanceId = await client.ScheduleNewOrchestrationInstanceAsync(nameof(ABCOrchestrator), input);
}
catch (Exception ex)
{
throw;
}
}
}
Class-based activities and orchestrations:
[DurableTask(nameof(SayHelloActivity))]
public class SayHelloActivity : TaskActivity<string, string>
{
public override async Task<string> RunAsync(TaskActivityContext context, string input)
{
return input;
}
}
[DurableTask(nameof(ABCOrchestrator))]
public class ABCOrchestrator : TaskOrchestrator<string, string>
{
public ABCOrchestrator() { }
public async override Task<string> RunAsync(TaskOrchestrationContext context, string input)
{
var result = await context.CallSayHelloActivityAsync(input);
return result;
}
}
Program.cs:
using FunctionApp;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.Azure.Functions.Worker.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
var builder = FunctionsApplication.CreateBuilder(args);
builder.ConfigureFunctionsWebApplication();
builder.Services.Configure<KestrelServerOptions>(options =>
{
options.AllowSynchronousIO = true;
});
builder.Build().Run();
.csproj:
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<FunctionsEnableWorkerIndexing>false</FunctionsEnableWorkerIndexing>
<FunctionsEnableExecutorSourceGen>false</FunctionsEnableExecutorSourceGen>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="2.0.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.DurableTask" Version="1.1.7" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage" Version="6.6.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="2.0.0" />
<PackageReference Include="Microsoft.DurableTask.Generators" Version="1.0.0-preview.1" />
</ItemGroup>
Able to run the function:
- Uploaded file to Storage container:
Console output:
Functions:
ABCOrchestrator: orchestrationTrigger
Function1_HttpStart: blobTrigger
SayHelloActivity: activityTrigger
For detailed output, run func with --verbose flag.
[2025-02-21T07:49:00.317Z] Worker process started and initialized.
[2025-02-21T07:49:01.252Z] Host lock lease acquired by instance ID '000000000000000000000000F72731CC'.
[2025-02-21T07:49:35.427Z] Executing 'Functions.Function1_HttpStart' (Reason='New blob detected(LogsAndContainerScan): container1/Hello World.txt', Id=1827ccc8-6d36-4a54-b5e8-e02118724e36)
[2025-02-21T07:49:35.434Z] Trigger Details: MessageId: 0a14a271-fc8e-4862-b4ce-1f3b33d24611, DequeueCount: 1, InsertedOn: 2025-02-21T07:49:34.000+00:00, BlobCreated: 2025-02-21T06:39:48.000+00:00, BlobLastModified: 2025-02-21T07:49:31.000+00:00
[2025-02-21T07:49:35.833Z] Scheduling new ABCOrchestrator orchestration with instance ID '301c60dfc2d74ac7b884c9c4d4d5b15f' and 14 bytes of input data.
[2025-02-21T07:49:36.012Z] Executed 'Functions.Function1_HttpStart' (Succeeded, Id=1827ccc8-6d36-4a54-b5e8-e02118724e36, Duration=913ms)
[2025-02-21T07:49:36.083Z] Executing 'Functions.ABCOrchestrator' (Reason='(null)', Id=3ceb14a5-eaf6-4a29-b2ca-ebc415e93340)
[2025-02-21T07:49:36.266Z] Executed 'Functions.ABCOrchestrator' (Succeeded, Id=3ceb14a5-eaf6-4a29-b2ca-ebc415e93340, Duration=198ms)
[2025-02-21T07:49:36.330Z] Executing 'Functions.SayHelloActivity' (Reason='(null)', Id=84e1ddba-2e67-4c57-9c9b-6ac453fb83a1)
[2025-02-21T07:49:36.346Z] Executed 'Functions.SayHelloActivity' (Succeeded, Id=84e1ddba-2e67-4c57-9c9b-6ac453fb83a1, Duration=18ms)
[2025-02-21T07:49:36.405Z] Executing 'Functions.ABCOrchestrator' (Reason='(null)', Id=4d2f75d0-b0ba-48a5-9377-7577a2c42582)
[2025-02-21T07:49:36.425Z] Executed 'Functions.ABCOrchestrator' (Succeeded, Id=4d2f75d0-b0ba-48a5-9377-7577a2c42582, Duration=21ms)
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745169851a4614859.html
评论列表(0条)