Ich befolge den Rat in Service Fabric spawn actor on startup für das Laichen ein paar Schauspieler beim Service Start. Ich habe eine benutzerdefinierte ActorService Unterklasse mit der folgenden RunAsync Überschreibung:Laichen Akteure in RunAsync wirft "Interface-ID '1830616258' ist nicht durch das Objekt 'CustomActorService.InternalCustomActorService' implementiert"
internal sealed class InternalCustomActorService : ActorService
{
protected async override Task RunAsync(CancellationToken cancellationToken)
{
await base.RunAsync(cancellationToken);
for(int i = 0; i < 10; i++)
{
ICustomActor proxy = ActorProxy.Create<ICustomActor>(new ActorId(i));
await proxy.StartAsync();
}
}
...
Die Klasse in Program.cs registriert ist wie folgt:
ActorRuntime.RegisterActorAsync<CustomActor>(
(context, actorType) => new InternalCustomActorService(context, actorType,() => new CustomActor())).GetAwaiter().GetResult();
aber ich erhalte die folgende Ausnahme Aufruf proxy.StartAsync()
Methode:
FatalExecutionEngineError occurred
HResult=-2146233088
Message=One or more errors occurred.
Source=Microsoft.ServiceFabric.Services
StackTrace:
at Microsoft.ServiceFabric.Services.Communication.Client.ServicePartitionClient`1.<InvokeWithRetryAsync>d__7`1.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.ServiceFabric.Services.Remoting.Client.ServiceRemotingPartitionClient.<InvokeAsync>d__8.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.ServiceFabric.Services.Remoting.Builder.ProxyBase.<InvokeAsync>d__0.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.ServiceFabric.Services.Remoting.Builder.ProxyBase.<ContinueWith>d__b.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at CustomActorService.InternalCustomActorService.<RunAsync>d__2.MoveNext() in C:\_data\Master\CONSTABLE2\Apps\BSP\Research\ServiceFabric\CustomActorServiceApp\CustomActorService\InternalCustomActorService.cs:line 47
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.ServiceFabric.Services.Runtime.StatefulServiceReplicaAdapter.<ExecuteRunAsync>d__e.MoveNext()
InnerException:
HResult=-2147467263
Message=Interface id '1830616258' is not implemented by object 'CustomActorService.InternalCustomActorService'
Source=Microsoft.ServiceFabric.Services
InnerException:
Das Beispielprojekt ist auf GitHub hier https://github.com/PaloMraz/CustomActorServiceApp
Meine Frage ist: was mache ich falsch?
EDIT: Ich habe versucht, zusätzlichen BootstrapperService
staatenlos Dienst hinzuzufügen und die Schauspieler von dort laichen in BootstrapperService.RunAsync
:
protected override async Task RunAsync(CancellationToken cancellationToken)
{
await base.RunAsync(cancellationToken);
await Task.Delay(10000);
for (int i = 0; i < 10; i++)
{
ICustomActor proxy = ActorProxy.Create<ICustomActor>(new ActorId(i));
await proxy.StartAsync();
}
}
der Aufruf von proxy.StartAsync()
wirft jedoch genau die gleiche Ausnahme wie aus den InternalCustomActorService.RunAsync
oben.
Cool, danke! Ich war ein bisschen irreführend durch die Informationen hier https://azure.microsoft.com/en-us/documentation/articles/service-fabric-reliable-services-communication-remoting/: "The' Microsoft.ServiceFabric.Services.Remoting Der Namespace ".Runtime" enthält eine Erweiterungsmethode "CreateServiceRemotingListener" für statusfreie ** und Stateful-Dienste **, die zum Erstellen eines Remoting-Listeners mithilfe des Standard-Remoting-Transportprotokolls verwendet werden können. " –