In the past few weeks, I have moved from cloud services to service fabric and started working on several stumbling blocks using Remoting between the two services.
I use the official documentation and sample code for the Remoting service, and in particular, I am trying to get the sample described here to work:
https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-reliable-services-communication-remoting
I have 2 services. One of them is called "RemoteService" , and the other is called "CallerService" . Both are derived from the default Stateless Service project.
In the "RemoteService" and "CallerService" projects, I added the following interface to describe the service contract between them:
public interface IMyService : IService { Task<string> HelloNameAsync(string name); }
In "RemoteService", I created an asociated method in the RemoteService class
public Task<string> HelloNameAsync(string name) { return Task.FromResult("Hello " + name + "!"); }
I also override CreateServiceInstanceListeners with the following
protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners() { return new[] { new ServiceInstanceListener(context => this.CreateServiceRemotingListener(context)) }; }
In my "CallerService" , when I try to connect, make a call to "RemoteService" with the following:
IMyService helloNameClient = ServiceProxy.Create<IMyService>(new Uri("fabric:/Application/RemoteService")); string message = await helloNameClient.HelloNameAsync("Luke");
I get this exception
InnerException = {"Interface id '1994370306' is not implemented by object 'RemoteService.RemoteService'"}
I passed this sample with a thin comb and I am sure that I have everything in place, as it should be. I read about configuring endpoints and registering your services in the service directory, but from what I understand, this is for external services, and this is not mentioned in the Remoting documentation.
UPDATE:
This is how the RemoteService class is declared:
internal sealed class RemoteService : StatelessService, IMyService
UPDATE 2
This is what Settings.xml looks like for both services. These are the default settings that go out of the box with the project. I did not add or remove anything. I also want to note that I am doing all this on my local service.
<?xml version="1.0" encoding="utf-8" ?> <Settings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/2011/01/fabric"> </Settings>