public void IpcCallbackLoop() { var binding = new LocalBinding { MaxConnections = 5 }; var path = "ipc:///" + this.GetType().Name + "_" + MethodBase.GetCurrentMethod().Name; var reportWatch = new NStopwatch.Reportwatch(); for (int i = 0; i < 1000; i++) { DoHostWithCallbackInternal(reportWatch, binding, path); } reportWatch.ReportAll(); }
public void NamedPipeCallbackLoop() { var binding = new NetNamedPipeBinding() { MaxConnections = 5 }; var path = "net.pipe://127.0.0.1/" + this.GetType().Name + "_" + MethodBase.GetCurrentMethod().Name; var reportWatch = new NStopwatch.Reportwatch(); for (int i = 0; i < 1000; i++) { DoHostWithCallbackInternal(reportWatch, binding, path); } reportWatch.ReportAll(); }
private static void DoWcfHost2() { var reportWatch = new NStopwatch.Reportwatch(); DoWcfHost2Internal(reportWatch); reportWatch.Report("ServiceHost ctor"); reportWatch.Report("AddServiceEndpoint"); reportWatch.Report("Open"); reportWatch.Report("ChannelFactory ctor"); reportWatch.Report("CreateChannel"); reportWatch.Report("Execute"); }
private static void DoHostWithCallback(Binding binding, string path) { var reportWatch = new NStopwatch.Reportwatch(); DoHostWithCallbackInternal(reportWatch, binding, path); reportWatch.Report("ServiceHost ctor"); reportWatch.Report("AddServiceEndpoint"); reportWatch.Report("Open"); reportWatch.Report("ChannelFactory ctor"); reportWatch.Report("CreateChannel"); reportWatch.Report("Execute"); reportWatch.ReportAll(); }
private static void DoWcfHost() { var reportWatch = new NStopwatch.Reportwatch(); reportWatch.Start("ServiceHost ctor"); using (var server = new ServiceHost(new Service(), new Uri("net.pipe://127.0.0.1/testpipename"))) { reportWatch.Stop("ServiceHost ctor"); reportWatch.Start("AddServiceEndpoint"); var binding = new NetNamedPipeBinding { MaxConnections = 5 }; server.AddServiceEndpoint(typeof(IService), binding, "net.pipe://127.0.0.1/testpipename"); reportWatch.Stop("AddServiceEndpoint"); reportWatch.Start("Open"); server.Open(); reportWatch.Stop("Open"); reportWatch.Start("ChannelFactory ctor"); using (var channelFactory = new ChannelFactory <IService>(binding)) { reportWatch.Stop("ChannelFactory ctor"); reportWatch.Start("CreateChannel"); var client = channelFactory.CreateChannel(new EndpointAddress("net.pipe://127.0.0.1/testpipename")); reportWatch.Stop("CreateChannel"); reportWatch.Start("Execute"); client.Execute(new byte[0]); reportWatch.Stop("Execute"); } } reportWatch.Report("ServiceHost ctor"); reportWatch.Report("AddServiceEndpoint"); reportWatch.Report("Open"); reportWatch.Report("ChannelFactory ctor"); reportWatch.Report("CreateChannel"); reportWatch.Report("Execute"); }
private static void DoWcfHost(Binding binding, string path) { var reportWatch = new NStopwatch.Reportwatch(); reportWatch.Start("ServiceHost ctor"); using (var server = new ServiceHost(new Service(), new Uri(path))) { reportWatch.Stop("ServiceHost ctor"); reportWatch.Start("AddServiceEndpoint"); server.AddServiceEndpoint(typeof(IService), binding, path); reportWatch.Stop("AddServiceEndpoint"); reportWatch.Start("Open"); server.Open(); reportWatch.Stop("Open"); reportWatch.Start("ChannelFactory ctor"); using (var channelFactory = new ChannelFactory <IService>(binding)) { reportWatch.Stop("ChannelFactory ctor"); reportWatch.Start("CreateChannel"); var client = channelFactory.CreateChannel(new EndpointAddress(path)); reportWatch.Stop("CreateChannel"); reportWatch.Start("Execute"); client.Execute(new byte[0]); reportWatch.Stop("Execute"); } } reportWatch.Report("ServiceHost ctor"); reportWatch.Report("AddServiceEndpoint"); reportWatch.Report("Open"); reportWatch.Report("ChannelFactory ctor"); reportWatch.Report("CreateChannel"); reportWatch.Report("Execute"); }
private static void DoWcfHost() { var reportWatch = new NStopwatch.Reportwatch(); reportWatch.Start("ServiceHost ctor"); using (var server = new ServiceHost(new Service(), new Uri("net.pipe://127.0.0.1/testpipename"))) { reportWatch.Stop("ServiceHost ctor"); reportWatch.Start("AddServiceEndpoint"); var binding = new NetNamedPipeBinding { MaxConnections = 5 }; server.AddServiceEndpoint(typeof(IService), binding, "net.pipe://127.0.0.1/testpipename"); reportWatch.Stop("AddServiceEndpoint"); reportWatch.Start("Open"); server.Open(); reportWatch.Stop("Open"); reportWatch.Start("ChannelFactory ctor"); using (var channelFactory = new ChannelFactory<IService>(binding)) { reportWatch.Stop("ChannelFactory ctor"); reportWatch.Start("CreateChannel"); var client = channelFactory.CreateChannel(new EndpointAddress("net.pipe://127.0.0.1/testpipename")); reportWatch.Stop("CreateChannel"); reportWatch.Start("Execute"); client.Execute(new byte[0]); reportWatch.Stop("Execute"); } } reportWatch.Report("ServiceHost ctor"); reportWatch.Report("AddServiceEndpoint"); reportWatch.Report("Open"); reportWatch.Report("ChannelFactory ctor"); reportWatch.Report("CreateChannel"); reportWatch.Report("Execute"); }
private static void DoWcfHost(Binding binding, string path) { var reportWatch = new NStopwatch.Reportwatch(); reportWatch.Start("ServiceHost ctor"); using (var server = new ServiceHost(new Service(), new Uri(path))) { reportWatch.Stop("ServiceHost ctor"); reportWatch.Start("AddServiceEndpoint"); server.AddServiceEndpoint(typeof(IService), binding, path); reportWatch.Stop("AddServiceEndpoint"); reportWatch.Start("Open"); server.Open(); reportWatch.Stop("Open"); reportWatch.Start("ChannelFactory ctor"); using (var channelFactory = new ChannelFactory<IService>(binding)) { reportWatch.Stop("ChannelFactory ctor"); reportWatch.Start("CreateChannel"); var client = channelFactory.CreateChannel(new EndpointAddress(path)); reportWatch.Stop("CreateChannel"); reportWatch.Start("Execute"); client.Execute(new byte[0]); reportWatch.Stop("Execute"); } } reportWatch.Report("ServiceHost ctor"); reportWatch.Report("AddServiceEndpoint"); reportWatch.Report("Open"); reportWatch.Report("ChannelFactory ctor"); reportWatch.Report("CreateChannel"); reportWatch.Report("Execute"); }