WCF vs. .Net Remoting

前端 未结 4 1903
遥遥无期
遥遥无期 2021-01-30 13:50

according to this article, WCF with named pipes is the best choice for IPC, and it is around 25 % faster than .Net Remoting.

I have the following code that compares WCF

4条回答
  •  自闭症患者
    2021-01-30 14:29

    If, in addition to SSamra's code, you move the creation of your host outside of your WCF test (since, in my opinion you should only be creating the host just once) you can get even faster responses:

    static void Main(string[] args)
    {
        var address = "net.pipe://localhost/test";
    
        host = new ServiceHost(typeof(Remote));
        host.AddServiceEndpoint(typeof(IRemote), new NetNamedPipeBinding(NetNamedPipeSecurityMode.None), address);
        host.Open();
    
        proxy = ChannelFactory.CreateChannel(new NetNamedPipeBinding(NetNamedPipeSecurityMode.None), new EndpointAddress(address));
    
        TestWcf(Iterations);
        TestRemoting(Iterations);
    
        TestWcf(Iterations);
        TestRemoting(Iterations);
    
        TestWcf(Iterations);
        TestRemoting(Iterations);
    
        host.Close();
    
        Console.ReadKey();
    }
    

    Responses: enter image description here

    This shows that, when configured like this, WCF in process is significantly faster than .Net remoting!

提交回复
热议问题