Beispiel #1
0
        public UrlCompression SiteCompressionGet(string siteName)
        {
            Site site = _serverManager.Sites[siteName];
            if (site == null)
            {
                throw new Exception(string.Format("站点{0}不存在!", siteName));
            }

            Configuration siteConfig = site.GetWebConfiguration();
            ConfigurationSection urlCompressionSection = siteConfig.GetSection("system.webServer/urlCompression");

            UrlCompression urlCompression = new UrlCompression();
            urlCompression.IsStaticCompression = Convert.ToBoolean(urlCompressionSection["doStaticCompression"]);
            urlCompression.IsDynamicCompression = Convert.ToBoolean(urlCompressionSection["doDynamicCompression"]);

            return urlCompression;
        }
Beispiel #2
0
        public void SiteCompressionSet(string siteName, UrlCompression urlCompression)
        {
            Site site = _serverManager.Sites[siteName];

            if (site == null)
            {
                throw new Exception(string.Format("站点{0}不存在!", siteName));
            }

            Configuration siteConfig = site.GetWebConfiguration();
            ConfigurationSection urlCompressionSection = siteConfig.GetSection("system.webServer/urlCompression");
            urlCompressionSection["doStaticCompression"] = urlCompression.IsStaticCompression;
            urlCompressionSection["doDynamicCompression"] = urlCompression.IsDynamicCompression;

            _serverManager.CommitChanges();
        }
Beispiel #3
0
        public string SiteCompressionSet(DeveloperInfo developerInfo, string siteName, int appId, bool isStaticCompression, bool isDynamicCompression)
        {
            UrlCompression urlCompression = new UrlCompression();
            urlCompression.IsStaticCompression = isStaticCompression;
            urlCompression.IsDynamicCompression = isDynamicCompression;

            IISProcess iisProcess = new IISProcess(DeveloperConfig.SystemPhysicalPath, developerInfo.LoginName);
            iisProcess.SiteCompressionSet(siteName, urlCompression);

            DbCommand cmd = _dataBaseAccess.CreateCommand();
            cmd.CommandText = "Proc_Apps_SiteCompression_Update";

            DbParameter param = _dataBaseAccess.CreateParameter();
            param.ParameterName = "@AppId";
            param.DbType = DbType.Int32;
            param.Value = appId;
            cmd.Parameters.Add(param);

            param = _dataBaseAccess.CreateParameter();
            param.ParameterName = "@IsStaticCompression";
            param.DbType = DbType.Boolean;
            param.Value = isStaticCompression;
            cmd.Parameters.Add(param);

            param = _dataBaseAccess.CreateParameter();
            param.ParameterName = "@IsDynamicCompression";
            param.DbType = DbType.Boolean;
            param.Value = isDynamicCompression;
            cmd.Parameters.Add(param);

            _dataBaseAccess.ExecuteCommand(cmd);

            return string.Empty;
        }