Edit Compilation Settings (IIS 7)
Applies To: Windows 7, Windows Server 2008, Windows Server 2008 R2, Windows Vista
Edit .NET compilation settings in IIS 7 when you want to control how ASP.NET code is compiled.
For information about the levels at which you can perform this procedure, and the modules, handlers, and permissions that are required to perform this procedure, see Compilation Settings Feature Requirements (IIS 7).
Exceptions to feature requirements
- None
You can perform this procedure by using the user interface (UI), by running appcmd
commands in a command-line window, by editing configuration files directly, or by writing WMI scripts.
Open IIS Manager and navigate to the level you want to manage. For information about opening IIS Manager, see Open IIS Manager (IIS 7). For information about navigating to locations in the UI, see Navigation in IIS Manager (IIS 7).
In Features View, double-click .NET Compilation.
On the .NET Compilation page, edit settings as necessary.
When finished, click Apply in the Actions pane.
To enable or disable batch compilation for a site, use the following syntax:
appcmd set config /commit:WEBROOT /section:compilation /batch:True|False
The variable batch:True enables batch compilation, and the variable batch:False disables batch compilation. The default value is True.
To change the maximum file size (in KB) of the batch compilation, use the following syntax:
**appcmd set config /commit:WEBROOT /section:compilation /maxBatchGeneratedFileSize:**int
The variable int is the maximum file size (in KB). The default value is 1000.
To specify the maximum number of pages per batched compilation for a site, use the following syntax:
**appcmd set config /commit:WEBROOT /section:compilation /maxBatchSize:**int
The variable int is the maximum number of pages per batched compilation.
To define the time-out period, in seconds, for batch compilation for a site, use the following syntax:
**appcmd set config /commit:WEBROOT /section:compilation /batchTimeout:**timeSpan
The variable int is the maximum number of pages per batched compilation.
To specify compilation of retail or debug binaries for a site, use the following syntax:
appcmd set config /commit:WEBROOT /section:compilation /debug:True|False
The variable debug:True enables compilation of debug binaries and the variable debug:False enables compilation of retail binaries. The default value is False.
To specify the number of times resources can be dynamically recompiled before an application restarts for a site, use the following syntax:
**appcmd set config /commit:WEBROOT /section:compilation /numRecompilesBeforeAppRestart:**int
The variable int is the number of times resources are dynamically recompiled before the application is restarted. The default is 15.
To enable or disable URL line pragmas for a site, use the following syntax:
appcmd set config /commit:WEBROOT /section:compilation /urlLinePragmas:True|False
The variable urlLinePragmas:True enables URL line pragmas and the variable urlLinePragmas:False disables URL line pragmas. The default value is False.
To enable or disable Visual Basic explicit compilation for a site, use the following syntax:
appcmd set config /commit:WEBROOT /section:compilation /explicit:True|False
The variable explicit:True enables Visual Basic explicit compilation and the variable explicit:False disables explicit compilation. The default value is False.
To enable or disable Visual Basic strict compilation for a site, use the following syntax:
appcmd set config /commit:WEBROOT /section:compilation /strict:True|False
The variable strict:True enables Visual Basic strict compilation and the variable strict:False disables strict compilation. The default value is False.
To add an ASP.NET compilation processing directive for a site, use the following syntax:
appcmd set config /commit:WEBROOT /section:compilation /+"assemblies.[assembly='string']"
The variable string is the ASP.NET compilation processing directive.
To remove an ASP.NET compilation processing directive for a site, use the following syntax:
appcmd set config /commit:WEBROOT /section:compilation /-"assemblies.[assembly='string']"
The variable string is the ASP.NET compilation processing directive.
To change the default programming language that is used in dynamic compilation files for a site, use the following syntax:
**appcmd set config /commit:WEBROOT /section:compilation /defaultLanguage:**string
The variable string is the default programming language. The default value is vb. For example, to change the default programming language that is used in dynamic compilation files from Visual Basic to C#, type the following at the command prompt, and then press Enter:
appcmd set config /commit:WEBROOT /section:compilation /defaultLanguage:c#
To specify the directory to use for temporary file storage during compilation for a site, use the following syntax:
**appcmd set config /commit:WEBROOT /section:compilation /tempDirectory:**string
The variable string is the directory path.
Note
When you use Appcmd.exe to configure the <compilation> element at the global level in IIS 7, you must specify /commit:WEBROOT in the command so that configuration changes are made to the root Web.config file instead of ApplicationHost.config.
For more information about Appcmd.exe, see Appcmd.exe (IIS 7).
The procedure in this topic affects the following configuration element:
- <compilation>
For more information about IIS 7 configuration, see IIS 7.0: IIS Settings Schema on MSDN.
Use the following WMI classes, methods, or properties to perform this procedure:
- CompilationSection class
For more information about WMI and IIS, see Windows Management Instrumentation (WMI) in IIS 7. For more information about the classes, methods, or properties associated with this procedure, see the IIS WMI Provider Reference on the MSDN site.