Wednesday, January 27, 2010

Configure asp.net compilation

The behavior to compile a web application can be configured with web.config. A full schema is as following:

<compilation
debug="[true|false]"
batch="[true|false]"
batchTimeout="number of seconds"
defaultLanguage="language"
explicit="[true|false]"
maxBatchSize="maximim number of pages"
maxBatchGeneratedFileSize="maximum combined size"
numRecompilesBeforeAppRestart="number"
optimizeCompilations="[true|false]"
targetFrameworkMoniker="compilation target framework moniker"
strict="[true|false]"
tempDirectory="temporary files directory"
urlLinePragmas="[true|false]"
assemblyPostProcessorType="assembly post processor, assembly">
<assemblies>...</assemblies>
<buildproviders>...</buildproviders>
<codeSubDirectories>...</codeSubDirectories>
<compilers>...</compilers>
<expressionBuilders>...</expressionBuilders>
</compilation>

The assemblies section is given a full list of assemblies that are necessary to compile the application, in other words, all refered assemblies should be listed explicitely.

We usually don't see all of them listed because the web configure file within an application inherits the definition from machine.config and web.config files located in .Net framework installation folder CONFIG subfolder.


HttpHandlers define handlers to get control when a web request comes for a specific resource;

<httpHandlers>
<add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=11.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
</httpHandlers>

The path and verb parameters could be much more generic as in the following:
<add path="*.skin" verb="*" type="System.Web.HttpForbiddenHandler" validate="true"/>


In summary, a wide range of features are configurable for a web application. We need to put an eye on system level configuration as in machine.config and web.config in addition to application level web.config.

No comments: