I am trying to implement a generic duplex connection using WCF in Visual Studio 2015, however, upon running my client application this error appears:
The InstanceContext provided to the ChannelFactory contains a UserObject that does not implement the CallbackContractType 'Client.MyService.IMyServiceCallback'.
I can't seem to find anything wrong with the file referenced:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ServiceModel;
using Client.MyService;
namespace Client
{
class Program
{
static void Main(string[] args)
{
var callback = new InstanceContext(new ClientCallback());
var client = new MyServiceClient(callback);
client.Open();
client.Register();
Console.WriteLine("Press a key to exit");
Console.ReadKey();
client.Close();
}
}
}
And the interface seems to be implemented correctly:
namespace Client
{
public interface IMyServiceCallback
{
[OperationContract(IsOneWay = true)]
void Tick(DateTime dateTime);
}
}
namespace Client
{
public class ClientCallback : IMyServiceCallback
{
public void Tick(DateTime dateTime)
{
Console.WriteLine(dateTime);
}
}
}
Any help or advice would be greatly appreciated.