2

I need to enable WCF discovery in my mono project so I was following this example to test feature. This is my test code:

Uri baseAddress = new Uri(string.Format("http://{0}:8000/calc/{1}/",
                     System.Net.Dns.GetHostName(), Guid.NewGuid().ToString()));
using (ServiceHost serviceHost = new ServiceHost(typeof(testService), baseAddress))
{
    serviceHost.AddServiceEndpoint(typeof(icalc), new WSHttpBinding(), string.Empty);
    serviceHost.Description.Behaviors.Add(new ServiceDiscoveryBehavior());
    serviceHost.AddServiceEndpoint(new UdpDiscoveryEndpoint()); //<-- Exception here
    serviceHost.Open();
    Console.WriteLine("Press <ENTER> to terminate service.");
    Console.ReadLine();
}

[ServiceContract()]
public interface icalc
{
    [OperationContract()]
    int sum(int a, int b);
}

[ServiceBehavior()]
public class testService : icalc
{
    public int sum(int a, int b)
    {
        return a + b;
    }
}

Now the problem is in line where is UdpDiscoveryEndpoint added. I'am getting exception:

Contract 'TargetService' is not implemented in this service 'testService'

I tried to look at mono source, but could't find any workarounds for this problem. Looking forward for any ideas how to enable wcf discovery in mono or suggestions how could I fix my test code. P.s. code works great using .net framework.

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
Renatas M.
  • 11,694
  • 1
  • 43
  • 62

1 Answers1

0

Very unlikely at the time of the question whether Mono had WCF 4.5 UDP working .

user1496062
  • 1,309
  • 1
  • 7
  • 22