public SystemInfoSnapshot GetVmSystemInfo(string ip) { var myEndpoint = new EndpointAddress(EndpointCatalog.GetCellEndpoint(ip)); var netTcpBinding = new NetTcpBinding { Security = { Mode = SecurityMode.None } }; var myChannelFactory = new ChannelFactory <ISystemInfoRetriever>(netTcpBinding, myEndpoint); var wcfClient = myChannelFactory.CreateChannel(); var systemInfo = wcfClient.GetSystemInfo(); ((IClientChannel)wcfClient).Close(); return(systemInfo); }
public void OnVmServiceStartup() { var ipRetriever = new IpRetriever(); var ip = ipRetriever.GetContextIp(); var myEndpoint = new EndpointAddress(EndpointCatalog.GetCellEndpoint(ip)); var netTcpBinding = new NetTcpBinding { Security = { Mode = SecurityMode.None } }; var myChannelFactory = new ChannelFactory <ISystemInfoRetriever>(netTcpBinding, myEndpoint); var wcfClient = myChannelFactory.CreateChannel(); var systemInfo = wcfClient.GetSystemInfo(); ((IClientChannel)wcfClient).Close(); }