Google
 
欢迎光临
  发起投票 | 发起主题  
2009-02-27
男
机器人
帖子数: 16
无等级(0)

 

按照下面的配置就可以配置在其它位置了。如果web.config里面有的话就从web.config里面读,没有的话就在site.config里面读。 不用改其它的配置文件。

      public static OLConfiguration GetConfig()
  {

            OLConfiguration config = CacheHelper.Get(CacheKey) as OLConfiguration;
   if(config == null)
   {
                config = (OLConfiguration)ConfigurationManager.GetSection("openlab");
                if (config == null)
                {
                    string path;
                    if (HttpContext.Current != null)
                        path = HttpContext.Current.Server.MapPath("~/Site.config");
                    else
                        path = Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "Site.config";

                    if (!File.Exists(path))
                    {
                        throw new OLException(OLExceptionType.UnknownError, "发生错误: 虚拟目录或网站根目录下没有正确的Site.config文件");
                    }

                    XmlDocument doc = new XmlDocument();
                    doc.Load(path);
                    config = new OLConfiguration(doc);

                    CacheHelper.Max(CacheKey, config, new CacheDependency(path));
                    CacheHelper.ReSetFactor(config.CacheFactor);
                }
   }
   return config;
           
  }




 

2009-03-30 07:39 第 1 楼 回复 | 引用 | 编辑 | | Top

  1. 主页
  2. »
  3. 论坛首页
  4. »
  5. 科技文化
  6. »
  7. Openlab技术
  8. »
  9. 关于 opanlab 配置文件移到其它位置
 



Powered By Openlab v3.0 (Debug Build: 1.28817) © 2010. 页面执行: 0.078秒. 内存使用: 342.5MB. 8 次数据库查询.

京ICP备05050892号