サービス開始時に2人の俳優を産んだのはService Fabric spawn actor on startupです。次のようにクラスがProgram.csの中に登録されているRunAsyncのスポーンする俳優が「Interface id '1830616258'はオブジェクト 'CustomActorService.InternalCustomActorService'によって実装されていません」
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();
}
}
...
:しかし
ActorRuntime.RegisterActorAsync<CustomActor>(
(context, actorType) => new InternalCustomActorService(context, actorType,() => new CustomActor())).GetAwaiter().GetResult();
が、私はproxy.StartAsync()
メソッドを呼び出すと、次の例外を取得しています:私は、次のRunAsyncオーバーライドしてカスタムActorServiceサブクラスを持って
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:
サンプルプロジェクトは、ここではGitHubの上https://github.com/PaloMraz/CustomActorServiceApp
です私の質問です:私は間違って何ですか?
編集:私は追加BootstrapperService
ステートレスサービスを追加し、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();
}
}
それにも関わらず、proxy.StartAsync()
への呼び出しは、上記InternalCustomActorService.RunAsync
内からとまったく同じ例外がスローされます。
よろしくお願いいたします。私はここの情報で少し誤解を感じました。https://azure.microsoft.com/en-us/documentation/articles/service-fabric-reliable-services-communication-remoting/:「Microsoft.ServiceFabric.Services.Remoting .Runtime'ネームスペースには、デフォルトのリモーティングトランスポートプロトコルを使用してリモートリスナーを作成するために使用できる、ステートレスサービス**とステートフルサービス**の両方の拡張メソッド 'CreateServiceRemotingListener'が含まれています。 –