WCFControl.cs 1.6 KB
using log4net;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.ServiceModel;
using System.Text;

namespace OnlineStore.ACSingleStore
{
  public  class WCFControl
    {
        //public static bool  isRun=false;
        //public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
        //private static ServiceHost host = null;
        //public static void OpenWCF()
        //{
        //    if (isRun)
        //    {
        //        return;
        //    }
        //    try
        //    {
        //        if (host == null)
        //        {
        //            host = new ServiceHost(typeof(AcStoreWCF.CWSMDBox));
        //        }
        //        if (host.State != CommunicationState.Opening)
        //        {
        //            host.Open();
        //        }
        //        isRun = true;
        //        LogUtil.info("打开WCF服务成功");
        //    }
        //    catch (Exception ex)
        //    {
        //        LogUtil.error("打开WCF服务出错:" + ex.ToString());
        //    }
        //}

        //public static void CloseWCF()
        //{
        //    try
        //    {
        //        isRun = false;
        //        if (host != null)
        //        {
        //            host.Close();
        //        }
        //        LogUtil.info("关闭WCF服务成功");
        //    }
        //    catch (Exception ex)
        //    {
        //        LogUtil.error("关闭WCF服务出错:" + ex.ToString());
        //    }
        //}
    }
}