0

I am getting the below error. I have added required nuget package Microsoft.ServiceFabric.Services.Remoting v3.0.472.

'VotingDataService' does not contain a definition for 'CreateServiceRemotingListener' and no extension method 'CreateServiceRemotingListener' accepting a first argument of type 'VotingDataService' could be found (are you missing a using directive or an assembly reference?)

using Microsoft.ServiceFabric.Services.Communication.Runtime;
using Microsoft.ServiceFabric.Services.Remoting;
using Microsoft.ServiceFabric.Services.Remoting.Runtime;
using Microsoft.ServiceFabric.Services.Runtime;
using System;
using System.Collections.Generic;
using System.Fabric;
using System.Threading.Tasks;

namespace VotingDataService
{
    public interface IVotingDataService2 : IService
    {
        Task<int> AddVote(string voteItem);
    }

    /// <summary>
    /// The FabricRuntime creates an instance of this class for each service type instance. 
    /// </summary>
    internal sealed class VotingDataService : StatefulService, IVotingDataService2
    {
        public VotingDataService(StatefulServiceContext context)
            : base(context)
            { }

    public Task<int> AddVote(string voteItem)
    {
        throw new NotImplementedException();
    }

    protected override IEnumerable<ServiceReplicaListener> CreateServiceReplicaListeners()
    {
        return new[]
        {

            new ServiceReplicaListener(context =>
                this.CreateServiceRemotingListener(context))
        };
    }


    }
}
kumar
  • 8,207
  • 20
  • 85
  • 176

1 Answers1

0

Don't forget to implement an interface that extends IService. The extension method works on IService. (IMyService in the example)

More info here.

LoekD
  • 11,402
  • 17
  • 27
  • I have updated the above code and implemented IService I still get the same error. – kumar May 12 '18 at 08:50
  • I figured out what the problem is I as creating a stateful service under ".Net Core 2.0" when I created the same stateful service under ".Net Framework". Is this not supported in .Net Core 2 ? – kumar May 13 '18 at 05:06
  • Oh, make sure to use Remoting V2. https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-reliable-services-communication-remoting#how-to-use-remoting-v2-stack – LoekD May 14 '18 at 06:11
  • @LoekD - I am facing the same issue but unable to understand the significance of Remoting V2. The Microsoft page is not that clear either. Can you please elaborate? – Tarun Bhatt Apr 28 '19 at 09:10
  • This is because dotnet core apps only support remoting v2. – LoekD Apr 28 '19 at 17:27