2016-04-22 62 views
0

我正在從Framework 4.6將「舊」代碼遷移到通用應用程序代碼以使用WCF服務。我有不同的綁定,NetTCP綁定工作正常,配置綁定時使用UDP綁定4.6框架中的WCF我無法在.NET for Universal Apps中找到System.ServiceModel中的UDPbinding。 我需要儘可能快的通信,而.nettcpbinding似乎還不夠。 我已添加爲參考System.ServiceModel和System.ServiceModel.Channels 任何想法? 這是從.NETCORE客戶通用我的代碼用於配置連接到WCF服務:在通用應用程序框架中配置UDP綁定

try 
    { 

    //Here I cannot find the UDPbinding!!!!! 
    UdpBinding myBinding = new UdpBinding(); 
    EndpointAddress addr = new EndpointAddress("soap.udp://" + ipAddress + ":" + portNo); 
    ChannelFactory<IService1> chn = new ChannelFactory<IService1>(myBinding, addr); 
    IService1 conn = chn.CreateChannel(); 
    return conn; 
    } 
    catch (Exception ex) 
    { 
     return null; 
    } 

我的服務器服務配置程序是這樣的:

private void ConfigService(string portNo) { 

     host = new ServiceHost(typeof(WCFComm), new Uri("http://localhost:/XXX/XXX")); 
     // Add service endpoint 
     UdpBinding myBinding = new UdpBinding(); 
     string address = "soap.udp://localhost:" + portNo; 
     host.AddServiceEndpoint(typeof(IService1), myBinding, address); 
     try {host.Open();} catch(Exception ex) {} 
    } 

感謝,

回答

1

對不起它不支持只BasicHttp

+0

嗨,我有一個本地網絡,我需要高速(像一些在線視頻遊戲),你建議的建築學? – ronconsoda

+0

也許你可以使用Signal R –

+0

我不這麼認爲。我正在與通用應用程序溝通4.5框架。我的想法是使用UDP,但我無法從botr框架中找到兼容的類 – ronconsoda