开发者

ASP.NET framework bug

开发者 https://www.devze.com 2023-03-07 00:51 出处:网络
Go into your iis machine level settings and add <deployment retail=\"true\" /> As specified in http://msdn.microsoft.com/en-us/library/ms228298.aspx

Go into your iis machine level settings and add

<deployment retail="true" /> 

As specified in http://msdn.microsoft.com/en-us/library/ms228298.aspx

Create a new web project, add a label and then the following code.

protected void Page_Load(object sender, EventArgs e)
{
    Label1.Text = HttpContext.Current.IsDebuggingEnabled.ToString();
}

//Result: true 

What am I missing?

Update: I updated the value on the 64 and 32 bit versions of the machine config. The server is running IIS7.5. Reboot didn't help.

Update 2:

Stepping through V4 of the framework using Reflector I get the following code.

public bool IsDebuggingEnabled
{
    get
    {
        try
        {
            return CompilationUtil.IsDebuggingEnabled(this);
        }
        catch
        {
            return false;
        }
    }
}

internal static bool IsDebuggingEnabled(HttpContext context)
{
    return MTConfigUtil.GetCompilationConfig(context).Debug;
}

//Here is where I lose whats going on... Either way, if what Yaur said is correct then
//I believe that value is not only useless but dangerously misleading. 
internal static CompilationSection GetCompilationConfig(HttpContext context)
{
    if (!UseMTConfig)
    {
        return RuntimeConfig.GetConfig(context).Compilation;
    }
    return GetConfig<CompilationSection>(context);
}

Either way. What I can confirm is that the functionality does not seem to work.

开发者_高级运维

PS: @Yaur - Yes I have tried changing the value and I am well aware of the alternatives to using this method but the point is that this method is supposed to simplify deployment.


According to : http://weblogs.asp.net/scottgu/archive/2006/04/11/442448.aspx, it should force :

<system.web>
  <compilation debug="false">
</system.web>

Have you rebooted your server ? Which machine.config did you edit ?


Looking at HttpContext in reflector all this method does is to load the value found in the compilation section. So set that as mathieu suggested and you you should be golden.
Also (if you care) it will throw an exception if running under mono.

from the 2.0 version of System.Web:

it calls

CompilationUtil.IsDebuggingEnabled(this);

which calls

RuntimeConfig.GetConfig(context).Compilation.Debug;

Compilation.Get returns

(CompilationSection) this.GetSection("system.web/compilation", typeof(CompilationSection), ResultsIndex.Compilation);

the 4.0 version is a bit different... based on what I can tell it looks the "extra stuff" is multitargeting support. So if you are targeting .net 4 and setting <compilation debug="false"> didn't work try following the example here and use

<system.web>
    <compilation debug="false" targetFramework="4.0">
</compilation>

instead

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号