Exemple #1
0
        static void Main(string[] args)
        {
            WcfMessageHubService hubService = new WcfMessageHubService(new AppConnectedClientRepository <WcfConnectedClient>());
            ServiceHost          svc        = new ServiceHost(hubService);

            svc.AddServiceEndpoint(typeof(IMessageHubService), new NetTcpBinding(), "net.tcp://localhost:9099/DemoHub");
            svc.Open();
            Console.WriteLine("Server running at net.tcp://localhost:9099/DemoHub");

            Console.ReadLine();
            svc.Close();
        }
        public void Initialize()
        {
            IConnectedClientRepository <WcfConnectedClient> repo = new AppConnectedClientRepository <WcfConnectedClient>();
            WcfMessageHubService instance = new WcfMessageHubService(repo);

            svc = new ServiceHost(instance);
            svc.AddServiceEndpoint(typeof(IMessageHubService), new NetTcpBinding(), "net.tcp://localhost:8000/TestHubService");
            svc.Open();

            test = new TestServiceReceiver();

            svcChannel = new DuplexChannelFactory <IMessageHubService>(test, new NetTcpBinding(), new EndpointAddress("net.tcp://localhost:8000/TestHubService"));
            client     = svcChannel.CreateChannel();
        }