wcf将一个服务同时绑定到http和tcp的写法 (网络搜集资料,未进行验证)

wcf将一个服务同时绑定到http和tcp的写法 服务器端:                                                                                                                                                                                                                                                                                                 客户端(通过8000端口或者8001端口都可以用,上面的服务器端配置同时绑定了HTTP 8000端口和TCP8001端口)                                                                                                                                                                                                                                          客户端代码 //using (DcDataServiceClient client = new DcDataServiceClient())//这个时候要注释掉其中一个endpoint             //using (DcDataServiceClient client = new DcDataServiceClient("NetTcpBinding_IDcDataService"))             using (DcDataServiceClient client = new DcDataServiceClient("NetTcpBinding_IDcDataService"))             {                 DCArea[] lstAreas = client.GetAllDCAreas();                 foreach (DCArea area in lstAreas)                 {                     ShowDbgInfo(area.DcName);                 }             }
posted @ 2022-07-14 15:06  devgis  阅读(45)  评论(0编辑  收藏  举报