コード例 #1
0
ファイル: Program.cs プロジェクト: kouweizhong/MessageHub
        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();
        }
コード例 #2
0
        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();
        }