zoukankan      html  css  js  c++  java
  • c#代码获取web.config配置文件里面设置的 <compilation debug="true"节点

    ==

    在我们的web.config文件中,有像下面的这样的一个配置,

      <system.web>
        <identity impersonate="true" userName="webuser" password="webuser"/>
        <compilation debug="true" targetFramework="4.0" />
      </system.web>

    <compilation debug="true"> 意味着可以插入一些debugger的中断,这样在开发是就可以调试了。
    false 用于已经发布的项目,它不需要再调试了, 一般开发是用true, 发布正式项目用false.
    主要区别是设置为true时
    1) 由于编译优化被取消,编译ASP.NET 页需要更长的时间
    2) 由于需要额外的debug,代码执行比较慢
    3) 在系统运行时runtime 占用更多的内存,需要为debug创建冗余代码。
    4) 脚本Scripts和图片没有被缓存cache,所以下载很慢。
    所以以发布的项目一定要设为false.

    出处:https://zhidao.baidu.com/question/2272336873195020908.html

    ===================================================================

    下面代码可以获取掉debug的值

    System.Web.Configuration.CompilationSection cmp = (System.Web.Configuration.CompilationSection)System.Configuration.ConfigurationManager.GetSection("system.web/compilation");
    if (!cmp.Debug)
    {
        filterContext.ExceptionHandled = true;
    }

    这里有CompilationSection 类的介绍,微软官方的地址:

    https://msdn.microsoft.com/zh-cn/library/system.web.configuration.compilationsection(v=vs.80).aspx

    出处:https://blog.csdn.net/u011511086/article/details/77767998

  • 相关阅读:
    使用shell生成excel
    linux逻辑卷扩容
    nginx异常访问处理
    云主机上的k8s集群通信故障
    【转】 Pro Android学习笔记(七九):服务(4):远程服务的实现
    老李分享:系统可用性评估
    Develoment 和 Production 模式的区分打包
    TS基础学习笔记
    flanneld 安装
    Execl文件批量转csv文件
  • 原文地址:https://www.cnblogs.com/mq0036/p/9329013.html
Copyright © 2011-2022 走看看