Service Fabric Service Remoting

回眸只為那壹抹淺笑 提交于 2019-12-03 17:25:33
yoape

The assembly the service interface is declared in needs to be shared with the client, you cannot recreate an identical interface on the client side. When Service Fabric sets up the communication it builds up a map of the interface and it's methods from the actual assembly used by the service.

Based on your description, it looks like you are declaring an identical interface in both service and client project? If so, then this is the fix.

From SO: Calling services from other application in the cluster: The only tricky part is how do you get the interface from the external service to your calling service? You could simply reference the built .exe for the service you wish to call or you could package the assembly containing the interface as a NuGet package and put on a private feed.

If you don't do this and you instead just share the code between your Visual Studio solutions the Service Fabric will think these are two different interfaces, even if they share the exact same signature. If you do it for a Service you get an NotImplementedException saying "Interface id '{xxxxxxxx}' is not implemented by object '{service}'" and if you do it for an Actor you get an KeyNotfoundException saying "No MethodDispatcher is found for interface id '-{xxxxxxxxxx}'".

So, to fix your problem, make sure you reference the same assembly that is in the application you want to call in the external application that is calling.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!