public static void ReportState(SpiderResult result) { using (var factory = new ChannelFactory <ISpiderClientToManageClient>(new NetNamedPipeBinding() { MaxReceivedMessageSize = int.MaxValue }, new EndpointAddress("net.pipe://127.0.0.1/Server"))) { ISpiderClientToManageClient manageClientToManageSpiderClientChannel = factory.CreateChannel(); try { manageClientToManageSpiderClientChannel.TransferData(result); } catch (TimeoutException) { (manageClientToManageSpiderClientChannel as ICommunicationObject).Abort(); throw; } catch (CommunicationException) { (manageClientToManageSpiderClientChannel as ICommunicationObject).Abort(); throw; } finally { CloseChannel((ICommunicationObject)manageClientToManageSpiderClientChannel); } } }
/// <summary> /// 报告ie版本设置 /// </summary> /// <param name="ieVersion"></param> public static void ReportIEVersion(string ieVersion) { using (var factory = new ChannelFactory <ISpiderClientToManageClient>(new NetNamedPipeBinding(), new EndpointAddress("net.pipe://127.0.0.1/Server"))) { ISpiderClientToManageClient manageClientToManageSpiderClientChannel = factory.CreateChannel(); try { manageClientToManageSpiderClientChannel.ReportIEVersion(ieVersion); } catch (Exception ex) { throw; } finally { CloseChannel((ICommunicationObject)manageClientToManageSpiderClientChannel); } } }