当前位置:   article > 正文

C# 在嵌套浏览器里面让网页与客户端交互(wcf或ComVisible)_c#嵌套网页

c#嵌套网页

1 使用Wcf暴露服务

  1. [ServiceContract]
  2. public interface IOperateSevice
  3. {
  4. /// <summary>
  5. /// 保存信息到InsuranceClient主程序
  6. /// </summary>
  7. /// <param name="res"></param>
  8. /// <param name="curInsCompInfo"></param>
  9. [OperationContract]
  10. void SaveInfo(compAndChannelResponse[] res, InsCompInfo curInsCompInfo);
  11. }

 2 注册服务暴露在进程里面

  1. public static IOperateSevice GetSevice()
  2. {
  3. NetNamedPipeBinding binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
  4. binding.MaxReceivedMessageSize = 2147483647;
  5. binding.CloseTimeout = TimeSpan.FromMinutes(3);
  6. binding.OpenTimeout = TimeSpan.FromMinutes(3);
  7. binding.ReceiveTimeout = TimeSpan.FromMinutes(3);
  8. binding.SendTimeout = TimeSpan.FromMinutes(3);
  9. EndpointAddress addr = new EndpointAddress("net.pipe://localhost/Client/WCFSevice");
  10. ChannelFactory<IOperateSevice> cf = new ChannelFactory<IOperateSevice>(binding, addr);
  11. return cf.CreateChannel();
  12. }

 

 

本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号