ASP.NET Compilation Mode Auto vs Never

Suppose my ASPX page has no inline C # code blocks.

So, I can safely install

<pages compilationMode="Never" />

... in my web.config file and not worry about compilation errors.

Effectively, was there any punishment for using the following setting?

<pages compilationMode="Auto" />

i.e. Does auto detect a significant amount of time?

+3
source share
3 answers

The impact of the car seems very minor. (Although obviously never again ).

System.Web.UI.TemplateParser, ImportSourceFile, , Never:

if (this.CompilationMode == CompilationMode.Never)
{
    return null;
}

, , , , . , TemplateParser, , ParseStringInternal , <%:

if (!this.flags[2] && (match = BaseParser.aspCodeRegex.Match(text, startat)).Success)
{
    string str3 = match.Groups["code"].Value.Trim();
    if (str3.StartsWith("$", StringComparison.Ordinal))
    {
        this.ProcessError(SR.GetString("ExpressionBuilder_LiteralExpressionsNotAllowed", new object[] { match.ToString(), str3 }));
    }
    else
    {
        this.ProcessCodeBlock(match, CodeBlockType.Code, text);
    }
}

BaseParser.aspCodeRegex, :

public AspCodeRegex()
{
    base.pattern = @"\G<%(?!@)(?<code>.*?)%>";
    ...
}

, . - - - , .

+3

, , , . , , " " ( ) , ( / ).

, ?

; CMS-esque, SharePoint, , - , - .

, ( , ), , % JIT 60%, , ? 200-500, .

+2

Auto must be stronger than Always , and is safe fault-tolerant when adding embedded C # code.

Additional time will be spent determining whether to compile the page, which adds a little overhead compared to the Never option .

0
source

Source: https://habr.com/ru/post/1717543/


All Articles