如果确定应用程序在调试模式下运行,而无需使用的HttpContext。 (asp.net) [英] Determine if application is running in debug mode without using httpcontext. (asp.net)

查看:90
本文介绍了如果确定应用程序在调试模式下运行,而无需使用的HttpContext。 (asp.net)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在你可以使用一个ASP.NET MVC程序

In an ASP.NET MVC program you can use

HttpContext.Current.IsDebuggingEnabled

为了确定是否调试=真正的在web.config中。

In order to determine if debug="true" in the web.config.

我如何做到这一点没有提及的HttpContext?

How do I do this without referring to the HttpContext?

推荐答案

您必须手动读取配置是这样的:

You must read the configuration manually like this:

var compilation = (CompilationSection)ConfigurationManager.GetSection("system.web/compilation");

if (compilation.Debug)
{
    //Debug is on!
}

这篇关于如果确定应用程序在调试模式下运行,而无需使用的HttpContext。 (asp.net)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆