在ASP.NET中,什么决定了HostingEnvironment.IsDevelopmentEnvironment的值? [英] In ASP.NET, what determines the value of HostingEnvironment.IsDevelopmentEnvironment?

查看:68
本文介绍了在ASP.NET中,什么决定了HostingEnvironment.IsDevelopmentEnvironment的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MSDN文档没有说明如何,何时或为什么将此值设置为true.

The MSDN documentation does not explain how, when or why this value is set to true.

在web.config中设置<配置debug ="false"/> 不会将属性设置为false,也不会将< deployment retail ="true"/>设置为; 在machine.config中.

Setting <configuration debug="false" /> in web.config does not set the property to false, nor does setting <deployment retail="true" /> in machine.config.

我正在IIS Express上从Visual Studio 2012运行测试网站,我没有安装IIS正确".

I'm running the test website from Visual Studio 2012 on IIS Express, I do not have IIS 'proper' installed.

在回顾了Oscar的回答并进行了更多研究之后,似乎应该设置< deployment retail ="true"/> 为优先,所以我可能没有在正确的框架的machine.config中进行设置.当我问这个问题时.

After reviewing Oscar's answer and doing some more research, it seems that setting <deployment retail="true" /> should override, so I probably didn't set it in the right framework's machine.config when I asked this question.

推荐答案

此属性的反编译代码如下:

The decompiled code of this property is as follows:

public static bool IsDevelopmentEnvironment
{
    get
    {
        return ((AppDomain.CurrentDomain.GetData(".devEnvironment") as bool?) == true);
    }
}

但是我无法找到设置此值的位置.::(

But I couldn't fin where this value is set.. :-(

这篇关于在ASP.NET中,什么决定了HostingEnvironment.IsDevelopmentEnvironment的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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