Windows Azure Web Role: How to enable 32bit application mode in IIS Application Pool using Startup Task

It is very much possible that you may need to run 32 bit application inside Windows Azure Web role and to achieve it, you will have to configure IIS. In Windows Azure you will need proper start up script which will configure IIS to enable 32 bit application execution in the application pool.

Here are the instructions:

Step 1: You will need to create a simple text file name startup.cmd (or <anyname>.cmd) first and in this file you will add your command line script which will configure IIS Application Pool

Startup.cmd:

 %windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.enable32BitAppOnWin64:true

Note: Please make sure then when you launch CMD file, does it work as expected, means please test it completely for its correctness and expected result.

 

Step 2: Now you can update your Window Azure Service Definition file to include start up task as below with “Elevated” permission because this needs admin permission to effect.

ServiceDefinition.csdef

 <Startup>
 <Task commandLine="Startup.cmd" executionContext="Elevated" taskType="simple">
 </Task>
 </Startup>
 

 

Step 3: Now make sure that the Startup.cmd file is part of your Web Role application (VS2010 Solution) and set its property “Copy Local to True” so when you publish this package, it can be the part of your package.

 

To learn more about how to use Windows Azure Start up task, please study below blog:

https://blogs.msdn.com/b/avkashchauhan/archive/2011/03/17/using-startup-task-in-windows-azure-detailed-summary.aspx