When we are migrating our web applications servers, there might be chance to miss IIS configuration settings. For example we have several web applications hosted in Windows Server 2008 R2 and wants to upgrade server to Windows Server 2012. In this type of situation to configure all applications manually is tedious process and there may be chances for wrong configuration. We can overcome this by configuring the IIS settings through command prompt.
We can configure settings for all Application Pools at once or we can configure each application pool separately by using appcmd.exe. We will discuss each of these options in this article.
Configure all Application Pools settings: We can configure managedRuntimeVersion, enable32BitAppOnWin64, and managedPipelineMode settings of all Application Pools with below commands.
%SystemRoot%\System32\inetsrv\appcmd.exe set config /section:system.applicationHost/applicationPools /applicationPoolDefaults.managedRuntimeVersion:"v4.0" /commit:apphost
%SystemRoot%\System32\inetsrv\appcmd.exe set config /section:system.applicationHost/applicationPools /applicationPoolDefaults.enable32BitAppOnWin64:"False" /commit:apphost
%SystemRoot%\System32\inetsrv\appcmd.exe set config /section:system.applicationHost/applicationPools /applicationPoolDefaults.managedPipelineMode:"Classic" /commit:apphost
Above commands will change the all Application Pools management runtime to 4.0, enables 32-bit app on 64-bit machine and changes the pipeline mode to Classic.
Configure each Application Pool separately: We can configure each application pool separately by using Application name as shown below.
%SystemRoot%\System32\inetsrv\appcmd.exe set apppool /apppool.name:DefaultAppPool /managedRuntimeVersion:v4.0
%SystemRoot%\System32\inetsrv\appcmd.exe set apppool /apppool.name:DefaultAppPool /enable32BitAppOnWin64:True
%SystemRoot%\System32\inetsrv\appcmd.exe set apppool /apppool.name:DefaultAppPool /managedPipelineMode:Classic
Above commands will change the DefaultAppPool management runtime to 4.0, enables 32-bit app on 64-bit machine and changes the pipeline mode to Classic.
We can configure the IIS in silent mode by placing these commands .bat file.