I am doing a small project using Dapr and state management with .Net 6 following this tutorial https://www.gokhan-gokalp.com/en/building-microservices-by-using-dapr-and-net-with-minimum-effort-01/. But there is an exception that I dont know how to deal with. Please let me know, any ideas will be so appreciated to me.
An exception was thrown like this
Dapr.DaprException: 'State operation failed: the Dapr endpoint indicated a failure. See InnerException for details.'
Inner Exception
RpcException: Status(StatusCode="Unavailable", Detail="Error connecting to subchannel.", DebugException="System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it.
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|277_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
at Grpc.Net.Client.Balancer.Internal.SocketConnectivitySubchannelTransport.TryConnectAsync(CancellationToken cancellationToken)")
Here is the command running dapr
start dapr run --app-id shoppingcartapi --app-port 5001 --dapr-http-port 50001 --components-path "./components" -- dotnet run --project "./Dapr.ShoppingCart/Dapr.ShoppingCart.csproj"
start dapr run --app-id recommendationapi --app-port 6000 --dapr-http-port 50002 --components-path "./components" -- dotnet run --project "./Dapr.Recommendation/Dapr.Recommendation.csproj"
Here is the pubsub yaml file
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: eventbus
spec:
type: pubsub.redis
version: v1
metadata:
- name: redisHost
value: localhost:6379
- name: redisPassword
value: ""
and the statestore yaml file
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: redisstore
spec:
type: state.redis
metadata:
- name: redisHost
value: localhost:6379
- name: redisPassword
value: ""
- name: actorStateStore
value: "true"