赞
踩
1 使用Wcf暴露服务
- [ServiceContract]
- public interface IOperateSevice
- {
- /// <summary>
- /// 保存信息到InsuranceClient主程序
- /// </summary>
- /// <param name="res"></param>
- /// <param name="curInsCompInfo"></param>
- [OperationContract]
- void SaveInfo(compAndChannelResponse[] res, InsCompInfo curInsCompInfo);
-
- }
2 注册服务暴露在进程里面
- public static IOperateSevice GetSevice()
- {
- NetNamedPipeBinding binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
- binding.MaxReceivedMessageSize = 2147483647;
- binding.CloseTimeout = TimeSpan.FromMinutes(3);
- binding.OpenTimeout = TimeSpan.FromMinutes(3);
- binding.ReceiveTimeout = TimeSpan.FromMinutes(3);
- binding.SendTimeout = TimeSpan.FromMinutes(3);
- EndpointAddress addr = new EndpointAddress("net.pipe://localhost/Client/WCFSevice");
- ChannelFactory<IOperateSevice> cf = new ChannelFactory<IOperateSevice>(binding, addr);
- return cf.CreateChannel();
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。