发布网站时应该把debug设置false

在ASP.NET项目根目录下的Web.config中有这样的一个节点:

<compilation debug="true" targetFramework="4.5" />

 

在开发阶段的时候,可以这样设置。当把网站部署到服务器上后,必须把debug设置成false,如下:

<compilation debug="false" targetFramework="4.5" />

 

如果想让服务器上所有项目的debug属性值为false,必须到machine.config中设置。

 

32位电脑machine.config的所在位置是:%windir%\Microsoft.NET\Framework\[version]\config\machine.config
64位电脑machine.config的所在位置是:%windir%\Microsoft.NET\Framework64\[version]\config\machine.config

 

machine.configsystem.web节点下设置如下:

<configuration>
    <system.web>
          <deployment retail=”true”/>
    </system.web>
</configuration>

 

 

总之,当需要调试、跟踪错误,把debug属性设置为true,调试结束,再把debug属性设置为false。

posted @ 2014-11-26 09:43  Darren Ji  阅读(783)  评论(1编辑  收藏  举报

我的公众号:新语新世界,欢迎关注。