コード例 #1
0
        /// <summary>
        /// 暂停网站
        /// </summary>
        /// <param name="config">暂停网站的配置信息</param>
        /// <param name="sysDriver">系统分区卷名</param>
        /// <returns></returns>
        public ExecRsp PauseWebsite(WebsiteConfig4SiteNames config, string sysDriver = "c:")
        {
            if (config.SiteNames == null || config.SiteNames.Length == 0)
            {
                return(Util.GetRequiredErrRsp("WebsiteConfig4Del.SiteNames"));
            }

            string cmd = PAUSE_WEBSITE_CMD;

            cmd = PrecompileRemotingParams(cmd, config);
            cmd = Compiler.Compile <WebsiteConfig4SiteNames>(cmd, config, (attrName, orig) =>
            {
                if (string.Equals("SiteNames", attrName))
                {
                    List <string> siteNameLst = new List <string>((string[])orig);
                    siteNameLst = Lst.Map <string>(siteNameLst, (origVal) =>
                    {
                        return(string.Format("\"{0}\"", origVal));
                    });
                    return(Lst.Join <string>(siteNameLst, false, " "));
                }

                return(orig);
            });

            return(Exec(new string[] { cmd }, sysDriver));
        }
コード例 #2
0
        /// <summary>
        /// 配置程序集搜索位置,默认是从exe文件的同级目录和GAC中搜索所依赖的程序集
        /// </summary>
        /// <remarks>
        /// 只有在AppDomain未创建时设置才有效
        /// </remarks>
        /// <param name="assemblyDirs">程序集搜索位置集合</param>
        public static void ConfigProbing(List <string> assemblyDirs)
        {
            string assemblyProbingPath = Lst.Join <string>(assemblyDirs, true, ";");

            if (Str.IsNullOrWhiteSpace(assemblyProbingPath))
            {
                return;
            }

            AppDomain.CurrentDomain.SetData("PRIVATE_BINPATH", assemblyProbingPath);
            AppDomain.CurrentDomain.SetData("BINPATH_PROBE_ONLY", assemblyProbingPath);
            var m       = typeof(AppDomainSetup).GetMethod("UpdateContextProperty", BindingFlags.NonPublic | BindingFlags.Static);
            var funsion = typeof(AppDomain).GetMethod("GetFusionContext", BindingFlags.NonPublic | BindingFlags.Instance);

            m.Invoke(null, new object[] { funsion.Invoke(AppDomain.CurrentDomain, null), "PRIVATE_BINPATH", assemblyProbingPath });
        }