进入你的iis机器级别设置并添加如http://msdn.microsoft.com/en-us/library/ms228298.aspx中所述创建一个新的web项目,添加一个标签,然后添加以下代码。protectedvoidPage_Load(objectsender,EventArgse){Label1.Text=HttpContext.Current.IsDebuggingEnabled.ToString();}//Result:true我错过了什么?更新:我更新了机器配置的64位和32位版本的值。服务器正在运行IIS7.5。重启没有帮助。更新2:使用Reflector单步执行
System.Web.HttpContext.Current.IsDebuggingEnabled和System.Diagnostics.Debugger.IsAttached之间有什么区别吗?如果是这样,除了一个仅适用于Web应用程序而另一个适用于所有类型的项目之外,具体的区别是什么? 最佳答案 HttpContext.IsDebuggingEnabled关于web.config中的编译设置。Debugger.IsAttached定义是否实际上有一个事件的调试器在监听来自Web服务器的信息。请参阅DotnetPerls中的解释关于
我在这里为应该简单的东西画了一个空白......我正在尝试做类似的事情:"/> 最佳答案 HttpContext.IsDebuggingEnabledproperty:usingSystem.Web;if(HttpContext.Current.IsDebuggingEnabled){/*...*/}来自文档:GetsavalueindicatingwhetherthecurrentHTTPrequestisindebugmode[…]trueiftherequestisindebugmode;otherwise,false.
我在这里为应该简单的东西画了一个空白......我正在尝试做类似的事情:"/> 最佳答案 HttpContext.IsDebuggingEnabledproperty:usingSystem.Web;if(HttpContext.Current.IsDebuggingEnabled){/*...*/}来自文档:GetsavalueindicatingwhetherthecurrentHTTPrequestisindebugmode[…]trueiftherequestisindebugmode;otherwise,false.