Exemple #1
0
        public override void Publish()
        {
            // Create the QueryHandler
            IQueryHandler queryHandler = new ZyanObjectQueryHandler(ObjectSource);

            #region Start the WCF server
#if !MONO
            var wcfServer = new ServerQueryWcfHandler(queryHandler);
            var binding   = ServiceHelper.GetDefaultBinding();

            string serviceUri = ServiceHelper.GetServiceUri(null, null, Artefacts.ServiceConstants.ObjectsServiceName);
            wcfServer.Start(binding, serviceUri);
#endif
            #endregion

            #region Start the Zyan server

            // change service name to avoid conflict with Remoting service
            var serviceName = Artefacts.ServiceConstants.ZyanServicePrefix + Artefacts.ServiceConstants.ObjectsServiceName;
            var protocol    = ZyanConstants.GetDefaultServerProtocol(ZyanConstants.DefaultServicePort);
            var host        = new ZyanComponentHost(serviceName, protocol);
            host.RegisterQueryHandler(queryHandler);

            #endregion

            #region Start the remoting server

            var remotingServer = new ServerQueryRemotingHandlerObjects(queryHandler);
            // Register default channel for remote access
            Hashtable properties = new Hashtable();
            properties["name"] = Artefacts.ServiceConstants.ObjectsServiceName;
            properties["port"] = Artefacts.ServiceConstants.ObjectsPort;
            IChannel currentChannel = RemotingConstants.GetDefaultChannel(properties);
            ChannelServices.RegisterChannel(currentChannel, false);
            remotingServer.Start(Artefacts.ServiceConstants.ObjectsServiceName, false);

            #endregion
        }
Exemple #2
0
        public override void Publish()
        {
            // Create the QueryHandler
            IQueryHandler queryHandler = new ZyanObjectQueryHandler(ObjectSource);

            #region Start the WCF server
            #if !MONO
            var wcfServer = new ServerQueryWcfHandler(queryHandler);
            var binding = ServiceHelper.GetDefaultBinding();

            string serviceUri = ServiceHelper.GetServiceUri(null, null, Artefacts.ServiceConstants.ObjectsServiceName);
            wcfServer.Start(binding, serviceUri);
            #endif
            #endregion

            #region Start the Zyan server

            // change service name to avoid conflict with Remoting service
            var serviceName = Artefacts.ServiceConstants.ZyanServicePrefix + Artefacts.ServiceConstants.ObjectsServiceName;
            var protocol = ZyanConstants.GetDefaultServerProtocol(ZyanConstants.DefaultServicePort);
            var host = new ZyanComponentHost(serviceName, protocol);
            host.RegisterQueryHandler(queryHandler);

            #endregion

            #region Start the remoting server

            var remotingServer = new ServerQueryRemotingHandlerObjects(queryHandler);
            // Register default channel for remote access
            Hashtable properties = new Hashtable();
            properties["name"] = Artefacts.ServiceConstants.ObjectsServiceName;
            properties["port"] = Artefacts.ServiceConstants.ObjectsPort;
            IChannel currentChannel = RemotingConstants.GetDefaultChannel(properties);
            ChannelServices.RegisterChannel(currentChannel, false);
            remotingServer.Start(Artefacts.ServiceConstants.ObjectsServiceName, false);

            #endregion
        }