簡體   English   中英

單聲道中的WCF Udp發現

[英]WCF Udp Discovery in mono

我需要在我的mono項目中啟用WCF發現,因此我正在按照示例測試功能。 這是我的測試代碼:

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;
    }
}

現在問題出在哪里,添加了UdpDiscoveryEndpoint 我正在例外:

未在此服務“ testService”中實施合同“ TargetService”

我嘗試查看單聲道源,但找不到此問題的任何解決方法。 期待有關如何在單聲道中啟用wcf發現的任何想法,或如何修復測試代碼的建議。 使用.net框架,PS代碼可以很好地工作。

在提出問題時,Mono是否具有WCF 4.5 UDP工作的可能性很小。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM