0

I am attempting to setup a project with Aspire and DAPR.

I want to register a sidecar in my API and Frontend application that will use pubsub. The pubsub should come from a DAPR yaml component file.

I have wired up the DaprClient and created an endpoint on Frontend and API to receive a HHTP Post /publish. When I call this endpoint I get the following exception:

curl --request POST 'http://localhost:5133/publish'

Dapr.DaprException: Publish operation failed: the Dapr endpoint indicated a failure. See InnerException for details. ---> Grpc.Core.RpcException: Status(StatusCode="InvalidArgument", Detail="pubsub pubsub is not found") at Dapr.Client.DaprClientGrpc.MakePublishRequest(String pubsubName, String topicName, ByteString content, Dictionary2 metadata, String dataContentType, CancellationToken cancellationToken) --- End of inner exception stack trace --- at Dapr.Client.DaprClientGrpc.MakePublishRequest(String pubsubName, String topicName, ByteString content, Dictionary2 metadata, String dataContentType, CancellationToken cancellationToken) at Program.<>c.<<$>b__0_2>d.MoveNext() in C:\Users\myusername\source\repos\AspireApps\AspireApps.Web\Program.cs:line 42 --- End of stack trace from previous location --- at Microsoft.AspNetCore.Http.RequestDelegateFactory.ExecuteTaskResult[T](Task`1 task, HttpContext httpContext) at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

HEADERS Accept: / Host: localhost:5133 User-Agent: curl/8.13.0

My project stucture is as follow:

AspireApp
├───AspireApps.ApiService
│   ├───bin
│   │   └───...
│   ├───obj
│   │   └───...
│   └───Properties
├───AspireApps.AppHost
│   ├───bin
│   │   └───...
│   ├───obj
│   │   └───...
│   └───Properties
├───AspireApps.ServiceDefaults
│   ├───bin
│   │   └───...
│   └───obj
│       └───...
├───AspireApps.Web
│   ├───bin
│   │   └───...
│   ├───Components
│   │   ├───Layout
│   │   └───Pages
│   ├───obj
│   │   └───Debug
│   │       └───net9.0
│   │           ├───...
│   ├───Properties
│   └───wwwroot
│       └───lib
│           └───...
└───dapr
    └───components
        └─── pubsub.yaml

AppHost.cs

using CommunityToolkit.Aspire.Hosting.Dapr;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

var builder = DistributedApplication.CreateBuilder(args);

var cache = builder.AddRedis("cache").WithDbGate();

var daprState = builder.AddDaprStateStore("statestore");

DaprSidecarOptions sideCarOptions = new DaprSidecarOptions
{
    EnableAppHealthCheck = true,
    AppHealthCheckPath = "/health",
};

IResourceBuilder<RabbitMQServerResource>? rabbitmq = null;
var pubSubType = "pubsub.azure.servicebus";

if (builder.Environment.IsDevelopment())
{
    var username = builder.AddParameterFromConfiguration("rabbitmq-username", "guest", true);
    var password = builder.AddParameterFromConfiguration("rabbitmq-password", "guest", true);
    rabbitmq = builder.AddRabbitMQ("rabbitmq", username, password)
        .WithManagementPlugin();

    pubSubType = "pubsub.rabbitmq";
}
var daprPubSubBuilder = builder.AddDaprComponent("pubsub", pubSubType, new DaprComponentOptions
{
    LocalPath = Path.Combine("..", "dapr", "components")
});

var apiService = builder.AddProject<Projects.AspireApps_ApiService>("apiservice")
    .WithHttpHealthCheck("/health")
    .WithReference(cache)
    .WaitFor(cache)
    .WithDaprSidecar(sideCarOptions)
    .WithReference(daprState)
    .WithReference(daprPubSubBuilder);

// Wait for RabbitMQ in development
if (rabbitmq != null)
{
    apiService = apiService.WithReference(rabbitmq).WaitFor(rabbitmq);
}

var webFrontend = builder.AddProject<Projects.AspireApps_Web>("webfrontend")
    .WithExternalHttpEndpoints()
    .WithHttpHealthCheck("/health")
    .WithReference(cache)
    .WaitFor(cache)
    .WithDaprSidecar(sideCarOptions)
    .WithReference(daprState)
    .WithReference(daprPubSubBuilder)
    .WithReference(apiService)
    .WaitFor(apiService);

// Wait for RabbitMQ in development
if (rabbitmq != null)
{
    webFrontend = webFrontend.WithReference(rabbitmq).WaitFor(rabbitmq);
}

//Inject Dapr client for DI / service-to-service calls
builder.Services.AddDaprClient();

builder.Build().Run();

pubsub.yaml (i've tried this with and without the scopes)

apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
  name: pubsub
spec:
  type: pubsub.rabbitmq
  version: v1
  metadata:
  - name: host
    value: amqp://guest:guest@rabbitmq:5672
  - name: durable
    value: "true"
  - name: deletedWhenUnused
    value: "false"
  - name: autoAck
    value: "false"
  - name: deliveryMode
    value: "2"
  - name: requeueInFailure
    value: "true"
scopes:
- webfrontend
- apiservice

When the application launches, Aspire's dashboard lights up green. enter image description here

I do see in the sidecar console logs a message:

level=warning msg="A non-YAML resiliency file components was detected, it will not be loaded" app_id=apiservice instance=mymachinename scope=dapr.runtime type=log ver=1.15.10

WARNING: no application command found. Starting Dapr with id apiservice. HTTP Port: 59008. gRPC Port: 59006 time="2025-09-05T12:49:39.777069+01:00" level=info msg="Starting Dapr Runtime -- version 1.15.10 -- commit 0f5f0b75a944d56c0b78b5d8db31c268a1f21d90" app_id=apiservice instance=mymachinename scope=dapr.runtime type=log ver=1.15.10 time="2025-09-05T12:49:39.777069+01:00" level=info msg="Log level set to: info" app_id=apiservice instance=mymachinename scope=dapr.runtime type=log ver=1.15.10 time="2025-09-05T12:49:39.7776962+01:00" level=warning msg="mTLS is disabled. Skipping certificate request and tls validation" app_id=apiservice instance=mymachinename scope=dapr.runtime.security type=log ver=1.15.10 time="2025-09-05T12:49:39.7841769+01:00" level=info msg="Enabled features: SchedulerReminders" app_id=apiservice instance=mymachinename scope=dapr.runtime type=log ver=1.15.10 time="2025-09-05T12:49:39.7846949+01:00" level=info msg="metric spec: {"enabled":true}" app_id=apiservice instance=mymachinename scope=dapr.runtime.diagnostics type=log ver=1.15.10 time="2025-09-05T12:49:39.7846949+01:00" level=info msg="Using default latency distribution buckets: [1 2 3 4 5 6 8 10 13 16 20 25 30 40 50 65 80 100 130 160 200 250 300 400 500 650 800 1000 2000 5000 10000 20000 50000 100000]" app_id=apiservice instance=mymachinename scope=dapr.runtime.diagnostics type=log ver=1.15.10 time="2025-09-05T12:49:39.7846949+01:00" level=warning msg="The default value for 'spec.metric.http.increasedCardinality' will change to 'false' in Dapr 1.15 or later" app_id=apiservice instance=mymachinename scope=dapr.runtime.diagnostics type=log ver=1.15.10 time="2025-09-05T12:49:39.7865149+01:00" level=warning msg="A non-YAML resiliency file components was detected, it will not be loaded" app_id=apiservice instance=mymachinename scope=dapr.runtime type=log ver=1.15.10 time="2025-09-05T12:49:39.7865727+01:00" level=info msg="standalone mode configured" app_id=apiservice instance=mymachinename scope=dapr.runtime type=log ver=1.15.10 time="2025-09-05T12:49:39.7865727+01:00" level=info msg="app id: apiservice" app_id=apiservice instance=mymachinename scope=dapr.runtime type=log ver=1.15.10 time="2025-09-05T12:49:39.7876633+01:00" level=info msg="Dapr trace sampler initialized: ParentBased{root:AlwaysOnSampler,remoteParentSampled:AlwaysOnSampler,remoteParentNotSampled:AlwaysOffSampler,localParentSampled:AlwaysOnSampler,localParentNotSampled:AlwaysOffSampler}" app_id=apiservice instance=mymachinename scope=dapr.runtime type=log ver=1.15.10 time="2025-09-05T12:49:39.7882915+01:00" level=info msg="metrics server started on 0.0.0.0:59010/" app_id=apiservice instance=mymachinename scope=dapr.runtime type=log ver=1.15.10 time="2025-09-05T12:49:39.8285502+01:00" level=info msg="local service entry announced: apiservice -> 10.114.236.36:56419" app_id=apiservice component="nr (mdns/v1)" instance=mymachinename scope=dapr.contrib type=log ver=1.15.10 time="2025-09-05T12:49:39.8290925+01:00" level=info msg="Initialized name resolution to mdns" app_id=apiservice instance=mymachinename scope=dapr.runtime type=log ver=1.15.10 time="2025-09-05T12:49:39.8291985+01:00" level=info msg="Loading components…" app_id=apiservice instance=mymachinename scope=dapr.runtime type=log ver=1.15.10 time="2025-09-05T12:49:39.8313238+01:00" level=info msg="Waiting for all outstanding components to be processed…" app_id=apiservice instance=mymachinename scope=dapr.runtime type=log ver=1.15.10 time="2025-09-05T12:49:39.8319286+01:00" level=info msg="Component loaded: statestore (state.in-memory/v1)" app_id=apiservice instance=mymachinename scope=dapr.runtime.processor type=log ver=1.15.10 time="2025-09-05T12:49:39.8319286+01:00" level=info msg="All outstanding components processed" app_id=apiservice instance=mymachinename scope=dapr.runtime type=log ver=1.15.10 time="2025-09-05T12:49:39.8319286+01:00" level=info msg="Loading endpoints…" app_id=apiservice instance=mymachinename scope=dapr.runtime type=log ver=1.15.10 time="2025-09-05T12:49:39.8330666+01:00" level=info msg="Waiting for all outstanding http endpoints to be processed…" app_id=apiservice instance=mymachinename scope=dapr.runtime type=log ver=1.15.10 time="2025-09-05T12:49:39.8332717+01:00" level=info msg="All outstanding http endpoints processed" app_id=apiservice instance=mymachinename scope=dapr.runtime type=log ver=1.15.10 time="2025-09-05T12:49:39.8332717+01:00" level=info msg="Loading Declarative Subscriptions…" app_id=apiservice instance=mymachinename scope=dapr.runtime type=log ver=1.15.10 time="2025-09-05T12:49:39.8365689+01:00" level=info msg="gRPC server listening on TCP address: :59006" app_id=apiservice instance=mymachinename scope=dapr.runtime.grpc.api type=log ver=1.15.10 time="2025-09-05T12:49:39.8365689+01:00" level=info msg="Enabled gRPC tracing middleware" app_id=apiservice instance=mymachinename scope=dapr.runtime.grpc.api type=log ver=1.15.10 time="2025-09-05T12:49:39.8365689+01:00" level=info msg="Enabled gRPC metrics middleware" app_id=apiservice instance=mymachinename scope=dapr.runtime.grpc.api type=log ver=1.15.10 time="2025-09-05T12:49:39.8365689+01:00" level=info msg="Registering workflow engine for gRPC endpoint: [::]:59006" app_id=apiservice instance=mymachinename scope=dapr.runtime.grpc.api type=log ver=1.15.10 time="2025-09-05T12:49:39.8365689+01:00" level=info msg="API gRPC server is running on port 59006" app_id=apiservice instance=mymachinename scope=dapr.runtime type=log ver=1.15.10 time="2025-09-05T12:49:39.8365689+01:00" level=warning msg="The default value for 'spec.metric.http.increasedCardinality' will change to 'false' in Dapr 1.15 or later" app_id=apiservice instance=mymachinename scope=dapr.runtime.http type=log ver=1.15.10 time="2025-09-05T12:49:39.8377913+01:00" level=info msg="Enabled max body size HTTP middleware with size 4194304 bytes" app_id=apiservice instance=mymachinename scope=dapr.runtime.http type=log ver=1.15.10 time="2025-09-05T12:49:39.8378438+01:00" level=info msg="Enabled tracing HTTP middleware" app_id=apiservice instance=mymachinename scope=dapr.runtime.http type=log ver=1.15.10 time="2025-09-05T12:49:39.8378438+01:00" level=info msg="Enabled metrics HTTP middleware" app_id=apiservice instance=mymachinename scope=dapr.runtime.http type=log ver=1.15.10 time="2025-09-05T12:49:39.8384367+01:00" level=info msg="HTTP server listening on TCP address: :59008" app_id=apiservice instance=mymachinename scope=dapr.runtime.http type=log ver=1.15.10 time="2025-09-05T12:49:39.8389811+01:00" level=info msg="HTTP server is running on port 59008" app_id=apiservice instance=mymachinename scope=dapr.runtime type=log ver=1.15.10 time="2025-09-05T12:49:39.8389811+01:00" level=info msg="The request body size parameter is: 4194304 bytes" app_id=apiservice instance=mymachinename scope=dapr.runtime type=log ver=1.15.10 time="2025-09-05T12:49:39.8389811+01:00" level=info msg="gRPC server listening on TCP address: :56419" app_id=apiservice instance=mymachinename scope=dapr.runtime.grpc.internal type=log ver=1.15.10 time="2025-09-05T12:49:39.8389811+01:00" level=info msg="Enabled gRPC tracing middleware" app_id=apiservice instance=mymachinename scope=dapr.runtime.grpc.internal type=log ver=1.15.10 time="2025-09-05T12:49:39.8389811+01:00" level=info msg="Enabled gRPC metrics middleware" app_id=apiservice instance=mymachinename scope=dapr.runtime.grpc.internal type=log ver=1.15.10 time="2025-09-05T12:49:39.8389811+01:00" level=info msg="Internal gRPC server is running on :56419" app_id=apiservice instance=mymachinename scope=dapr.runtime type=log ver=1.15.10 time="2025-09-05T12:49:39.8416276+01:00" level=info msg="actors: state store is not configured - this is okay for clients but services with hosted actors will fail to initialize!" app_id=apiservice instance=mymachinename scope=dapr.runtime type=log ver=1.15.10 time="2025-09-05T12:49:39.8417428+01:00" level=info msg="Actor state store not configured - actor hosting disabled, but invocation enabled" app_id=apiservice instance=mymachinename scope=dapr.runtime.actor type=log ver=1.15.10 time="2025-09-05T12:49:39.8422631+01:00" level=info msg="application protocol: http. waiting on port 5506. This will block until the app is listening on that port." app_id=apiservice instance=mymachinename scope=dapr.runtime type=log ver=1.15.10 time="2025-09-05T12:49:39.8425038+01:00" level=info msg="Actor runtime started" app_id=apiservice instance=mymachinename scope=dapr.runtime.actor type=log ver=1.15.10 time="2025-09-05T12:49:39.8425038+01:00" level=info msg="worker started with backend dapr.actors/v1" app_id=apiservice instance=mymachinename scope=dapr.wfengine.durabletask.backend type=log ver=1.15.10 time="2025-09-05T12:49:39.8425038+01:00" level=warning msg="Graceful shutdown timeout is infinite, will wait indefinitely to shutdown" app_id=apiservice instance=mymachinename scope=dapr.runtime.actor type=log ver=1.15.10 time="2025-09-05T12:49:39.8425038+01:00" level=info msg="Workflow engine started" app_id=apiservice instance=mymachinename scope=dapr.runtime.wfengine type=log ver=1.15.10 time="2025-09-05T12:49:39.8430499+01:00" level=info msg="Reporting actor types: []" app_id=apiservice instance=mymachinename scope=dapr.runtime.actors.placement type=log ver=1.15.10 time="2025-09-05T12:49:39.8431251+01:00" level=info msg="Connected to placement localhost:6050" app_id=apiservice instance=mymachinename scope=dapr.runtime.actors.placement.client.connector.static type=log ver=1.15.10 time="2025-09-05T12:49:39.8448018+01:00" level=info msg="application discovered on port 5506" app_id=apiservice instance=mymachinename scope=dapr.runtime type=log ver=1.15.10 time="2025-09-05T12:49:39.8448018+01:00" level=info msg="App health probes starting" app_id=apiservice instance=mymachinename scope=dapr.apphealth type=log ver=1.15.10 time="2025-09-05T12:49:39.8448018+01:00" level=info msg="dapr initialized. Status: Running. Init Elapsed 58ms" app_id=apiservice instance=mymachinename scope=dapr.runtime type=log ver=1.15.10 time="2025-09-05T12:49:39.8510653+01:00" level=info msg="Connected to placement localhost:6050" app_id=apiservice instance=mymachinename scope=dapr.runtime.actors.placement.client type=log ver=1.15.10 time="2025-09-05T12:49:39.8581726+01:00" level=info msg="Connected and received scheduler hosts addresses: [localhost:6060]" app_id=apiservice instance=mymachinename scope=dapr.runtime.scheduler.watchhosts type=log ver=1.15.10 time="2025-09-05T12:49:39.8587389+01:00" level=info msg="Scheduler client initialized for address: localhost:6060" app_id=apiservice instance=mymachinename scope=dapr.runtime.scheduler.clients type=log ver=1.15.10 time="2025-09-05T12:49:39.8587389+01:00" level=info msg="Scheduler clients initialized" app_id=apiservice instance=mymachinename scope=dapr.runtime.scheduler.clients type=log ver=1.15.10 time="2025-09-05T12:49:39.8982609+01:00" level=info msg="Placement tables updated, version: 0" app_id=apiservice instance=mymachinename scope=dapr.runtime.actors.placement type=log ver=1.15.10 You're up and running! Dapr logs will appear here.
time="2025-09-05T12:50:04.85723+01:00" level=info msg="App entered healthy status" app_id=apiservice instance=mymachinename scope=dapr.apphealth type=log ver=1.15.10 time="2025-09-05T12:50:04.8631114+01:00" level=info msg="Application configuration loaded" app_id=apiservice instance=mymachinename scope=dapr.runtime type=log ver=1.15.10 time="2025-09-05T12:50:04.8631114+01:00" level=info msg="Registering hosted actors: []" app_id=apiservice instance=mymachinename scope=dapr.runtime.actor type=log ver=1.15.10 time="2025-09-05T12:50:04.8631114+01:00" level=info msg="Updating actor types: []" app_id=apiservice instance=mymachinename scope=dapr.runtime.actors.placement type=log ver=1.15.10 time="2025-09-05T12:50:04.8636744+01:00" level=info msg="Scheduler stream connected for [JOB_TARGET_TYPE_JOB]" app_id=apiservice instance=mymachinename scope=dapr.runtime.scheduler.cluster type=log ver=1.15.10

Running command dapr list

APP ID HTTP PORT GRPC PORT APP PORT COMMAND AGE CREATED

DAPRD PID CLI PID APP PID webfrontend 59007 59004 5133 3m 2025-09-05 12:49.39 37448 29752 0

apiservice 63121 63120 5506 1m 2025-09-05 12:51.44 25296 38188 0

Querying the metadata of the sidecar shows that the component is not loaded:

curl http://localhost:59007/v1.0/metadata

❮ {"id":"webfrontend","runtimeVersion":"1.15.10","enabledFeatures":["SchedulerReminders"],"components":[{"name":"statestore","type":"state.in-memory","version":"v1","capabilities":["ETAG","TRANSACTIONAL","TTL","DELETE_WITH_PREFIX","ACTOR"]}],"extended":{"cliPID":"29752","daprRuntimeVersion":"1.15.10"},"appConnectionProperties":{"port":5133,"protocol":"http","channelAddress":"localhost","health":{"healthCheckPath":"/health","healthProbeInterval":"5s","healthProbeTimeout":"500ms","healthThreshold":3}},"actorRuntime":{"runtimeStatus":"RUNNING","hostReady":true,"placement":"placement: connected"},"scheduler":{"connected_addresses":["localhost:6060"]}}

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.