Example #1
0
        /// <summary>
        /// Stops the customizaed Wcf Service Host.
        /// </summary>
        /// <returns>True if succeeded; otherwise false.</returns>
        public bool Stop()
        {
            ModuleProc PROC   = new ModuleProc("HostingServiceWrapper", "Stop");
            bool       result = false;

            try
            {
                if (_serviceHost != null)
                {
                    _serviceHost.Stop();
                    _serviceHost.Dispose();
                    _serviceHost = null;
                    result       = true;
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
            return(result);
        }
        /// <summary>
        /// Starts the customizaed Wcf Service Host.
        /// </summary>
        /// <param name="serviceType">Type of the service.</param>
        /// <param name="hostConfig">The host config.</param>
        /// <param name="baseAddresses">The base addresses.</param>
        /// <returns>True if succeeded; otherwise false.</returns>
        public bool Start(Type serviceType, Type[] knownTypes, params Uri[] baseAddresses)
        {
            ModuleProc PROC = new ModuleProc("WindowsHostingServiceWrapper", "Start");
            bool result = false;

            try
            {
                if (_serviceHost == null)
                {
                    Log.Info(PROC, "Initialize the service host object.");
                    _serviceHost = _serviceHostFactory.Create(serviceType, knownTypes, baseAddresses) as IWcfServiceHost;
                    Log.Info(PROC, "Successfully initialized the service host object.");
                    return _serviceHost.Start();
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
            return result;
        }
Example #3
0
        /// <summary>
        /// Starts the customizaed Wcf Service Host.
        /// </summary>
        /// <param name="serviceType">Type of the service.</param>
        /// <param name="hostConfig">The host config.</param>
        /// <param name="baseAddresses">The base addresses.</param>
        /// <returns>True if succeeded; otherwise false.</returns>
        public bool Start(Type serviceType, Type[] knownTypes, params Uri[] baseAddresses)
        {
            ModuleProc PROC   = new ModuleProc("WindowsHostingServiceWrapper", "Start");
            bool       result = false;

            try
            {
                if (_serviceHost == null)
                {
                    Log.Info(PROC, "Initialize the service host object.");
                    _serviceHost = _serviceHostFactory.Create(serviceType, knownTypes, baseAddresses) as IWcfServiceHost;
                    Log.Info(PROC, "Successfully initialized the service host object.");
                    return(_serviceHost.Start());
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
            return(result);
        }
        /// <summary>
        /// Stops the customizaed Wcf Service Host.
        /// </summary>
        /// <returns>True if succeeded; otherwise false.</returns>
        public bool Stop()
        {
            ModuleProc PROC = new ModuleProc("HostingServiceWrapper", "Stop");
            bool result = false;

            try
            {
                if (_serviceHost != null)
                {
                    _serviceHost.Stop();
                    _serviceHost.Dispose();
                    _serviceHost = null;
                    result = true;
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
            return result;
        }