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.
Prerequisites
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
To configure .NET compilation settings
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.
User Interface
To Use the UI
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.
Command-line
Enable or disable batch compilation
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.
Change maximum file size
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.
Specify maximum number of pages per batched compilation
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.
Define time-out period
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.
Specify compilation of retail or debug binaries
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.
Specify dynamic recompile frequency
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.
Enable or disable URL line pragmas
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.
Enable or disable Visual Basic explicit compilation
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.
Enable or disable Visual Basic strict compilation
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.
Add ASP.NET compilation processing directives
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.
Remove ASP.NET compilation processing directives
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.
Change default programming language
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#
Specify temporary file storage directory
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).
Configuration
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.
WMI
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.