man-group / dapr-sidekick-dotnet

Dapr Sidekick for .NET - a lightweight lifetime management component for Dapr
Apache License 2.0
175 stars 21 forks source link

Dapr Actors not working with Dapr Sidekick after changing Sidecar Ports #22

Closed fbridger closed 3 years ago

fbridger commented 3 years ago

Expected Behavior

Why does adding an appsettings.json and changing the Sidecar Port of the DemoActor Host stops the correct execution and throws ActorMethodInvocationException?

appsettings.json added

{
  "DaprSidekick": {
    "Enabled": true,
    "Sidecar": {
      "DaprHttpPort": "3501",
      "DaprGrpcPort": "50001",
      "MetricsPort": "9001"
    }
  }
}

Actual Behavior

Actor Client Error

Dapr.Actors.ActorMethodInvocationException
  HResult=0x80131500
  Message=Remote Actor Method Exception
  Source=Dapr.Actors
  StackTrace:
   at Dapr.Actors.DaprHttpInteractor.<InvokeActorMethodWithRemotingAsync>d__10.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Dapr.Actors.Communication.Client.ActorRemotingClient.<InvokeAsync>d__5.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Dapr.Actors.Client.ActorProxy.<InvokeMethodAsync>d__32.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at ActorClient.Program.<Main>d__0.MoveNext() in C:\Repos\dapr-sidekick-dotnet\samples\Actor\ActorSample\ActorSample.ActorClient\Program.cs:line 47

Inner Exception 1:
ActorInvokeException: No connection could be made because the target machine actively refused it.

Steps to Reproduce the Problem

Modified version of the original Sidekick Actor example Check: https://github.com/fbridger/dapr-sidekick-dotnet/commit/a746ea0c3334f17e7d24f809fef97e81613d0c7d

fbridger commented 3 years ago

Once again, I found my answer here: https://github.com/fbridger/dotnet-sdk/tree/master/examples/Actor#make-client-calls

Note: If you started the actor service with dapr port other than 3500, then set the environment variable DAPR_HTTP_PORT to the value of --dapr-http-port specified while starting the actor service before running the client in terminal.

On Windows: set DAPR_HTTP_PORT=<port>
On Linux, MacOS: export DAPR_HTTP_PORT=<port>