using CCWcfService; using System.ServiceModel; namespace Admin.NET.Application.CommonHelper { /// /// WCF服务帮助类 /// public class WCFServiceHelper { /// /// 获取SAPCC的WCF服务 Client对象 /// /// public static async Task GetWCFService_SAPCC_Client(SqlSugarRepository _sysConfigRep) { var config = await _sysConfigRep.GetFirstAsync(x => x.Code == "CCWcfAddress"); if (config == null) { throw Oops.Oh("没有找到配置编号'CCWcfAddress'的数据"); } var endpoint = config.Value; var factory = new ChannelFactory(new BasicHttpBinding(), new EndpointAddress(endpoint)); var client = factory.CreateChannel(); return client; } } }