admin管理员组

文章数量:1277362

I'm trying to get Aspire to run up a C# (.NET 8) project that exposes a DAPR service that uses gRPC. Another service will then use InvokeMethodGrpcAsync to call the service. Aspire throws this error:

The endpoint 'grpc' is not allocated for the resource '{project-name}'

This Aspire config is being used:

builder.AddProject<Projects.InternalAlpha>("Internal-Alpha")
    .WithDaprSidecar(new DaprSidecarOptions()
    {
        AppId = "internal-alpha",
        AppPort = 5021,
        DaprHttpPort = 54021,
        DaprGrpcPort = 54022,
        AppProtocol = "grpc",
        LogLevel = "debug",
    });

Aspire doesn't seem to like AppProtocol being set, and generates the exception for the sidecar:

Failed to create resource Internal-Alpha-dapr-cli
System.InvalidOperationException: The endpoint grpc is not allocated for the resource Internal-Alpha.

at Aspire.Hosting.ApplicationModel.EndpointReference.get_AllocatedEndpoint() in //src/Aspire.Hosting/ApplicationModel/EndpointReference.cs:line 105
at Aspire.Hosting.ApplicationModel.EndpointReference.get_Host() in /
/src/Aspire.Hosting/ApplicationModel/EndpointReference.cs:line 87
at Aspire.Hosting.Dapr.DaprDistributedApplicationLifecycleHook.<>c__DisplayClass6_1.b__11(IList1 updatedArgs) in /_/src/Aspire.Hosting.Dapr/DaprDistributedApplicationLifecycleHook.cs:line 218 at Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackAnnotation.<>c__DisplayClass1_0.<.ctor>b__0(CommandLineArgsCallbackContext c) in /_/src/Aspire.Hosting/ApplicationModel/CommandLineArgsCallbackAnnotation.cs:line 32 at Aspire.Hosting.Dcp.ApplicationExecutor.CreateExecutableAsync(AppResource er, ILogger resourceLogger, CancellationToken cancellationToken) in /_/src/Aspire.Hosting/Dcp/ApplicationExecutor.cs:line 1316 at Aspire.Hosting.Dcp.ApplicationExecutor.<CreateExecutablesAsync>g__CreateResourceExecutablesAsyncCore|62_0(IResource resource, IEnumerable1 executables, CancellationToken cancellationToken) in /_/src/Aspire.Hosting/Dcp/ApplicationExecutor.cs:line 1222

  • The app Internal-Alpha starts up and runs without warnings
  • The latest Aspire workload is installed, and all packages are latest
  • With the same settings, the project/sidecar runs up ok with docker compose and works as expected

What is the correct Aspire configuration?

本文标签: