所以我寫我的第一男主角的服務,我就遇到了這個錯誤MethodAccessException時到服務織物演員服務
System.MethodAccessException: Attempt by method 'Microsoft.ServiceFabric.Services.Remoting.Description.InterfaceDescription..ctor(System.String, System.Type, Microsoft.ServiceFabric.Services.Remoting.Description.MethodReturnCheck)' to access method 'Microsoft.ServiceFabric.Services.Common.IdUtil.ComputeId(System.Type)' failed.
at Microsoft.ServiceFabric.Services.Remoting.Description.InterfaceDescription..ctor(String remotedInterfaceKindName, Type remotedInterfaceType, MethodReturnCheck methodReturnCheck)
at Microsoft.ServiceFabric.Actors.Remoting.Builder.ActorCodeBuilder.<BuildProxyGenerator>b__5(Type t)
at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
at Microsoft.ServiceFabric.Services.Remoting.Builder.ProxyGeneratorBuilder`2.Build(Type proxyInterfaceType, IEnumerable`1 interfaceDescriptions)
at Microsoft.ServiceFabric.Services.Remoting.Builder.CodeBuilder.Microsoft.ServiceFabric.Services.Remoting.Builder.ICodeBuilder.GetOrBuildProxyGenerator(Type interfaceType)
at Microsoft.ServiceFabric.Actors.Remoting.Builder.ActorCodeBuilder.GetOrCreateProxyGenerator(Type actorInterfaceType)
at Microsoft.ServiceFabric.Actors.Client.ActorProxyFactory.CreateActorProxy[TActorInterface](Uri serviceUri, ActorId actorId, String listenerName)
at Microsoft.ServiceFabric.Actors.Client.ActorProxy.Create[TActorInterface](ActorId actorId, Uri serviceUri, String listenerName)
我有一個演員的服務和無狀態的Web API服務。在Web API控制器中,我試圖獲得像以下這樣的演員手柄:
var actorServiceProxy = ActorProxy.Create<IPaymentActor>(ActorId.CreateRandom(), new Uri("fabric:/PaymentService/PaymentActorService"));
這就是拋出異常的地方。任何想法爲什麼?
編輯:演員定義包括每個請求。 PaymentInfo對象標記爲DataContract FWIW
public interface IPaymentActor : IActor
{
/// <summary>
/// TODO: Replace with your own actor method.
/// </summary>
/// <returns></returns>
Task<PaymentInfo> GetPaymentInformation(CancellationToken cancellationToken);
/// <summary>
/// TODO: Replace with your own actor method.
/// </summary>
/// <param name="count"></param>
/// <returns></returns>
Task SetPaymentInformation(PaymentInfo info, CancellationToken cancellationToken);
}
你的演員界面是如何定義的?你可以發佈嗎? – yoape
完成。如前所述,PaymentInfo對象及其屬性標記爲用於序列化目的的DataContract。 –