In Windows Azure a startup task is a Command-Line Executable file that gets referenced in the Cloud Service Definition file (.csdef). When a deployment is uploaded to Windows Azure a component of the Windows Azure Platform called the Fabric Controller reads the Definition file to allocate the necessary resources for your Deployment. Once the environment is set up the Fabric Controller initializes the Role Startup Process.
<Startup>
<Task commandLine="StartupEnableASP.cmd" executionContext="elevated" taskType="simple">
</Task>
</Startup>
1. To enable ASP engine on a VM/hosted service.
start /w pkgmgr /iu:IIS-ASP
2. To make APPpool run as a 32 bit application.
%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.enable32BitAppOnWin64:true /commit:apphost
3. To enable scripterrors send to browser in case of an ASP application.
%windir%\system32\inetsrv\appcmd set config -section:system.webServer/asp -scriptErrorSentToBrowser:"True" /commit:apphost
4. To set scripttimeout for an ASP application.
%windir%\system32\inetsrv\appcmd set config -section:system.webServer/asp /limits.scriptTimeOut:"00:30:00" /commit:apphost
5. To disable session state management of an ASP application.
%windir%\system32\inetsrv\appcmd set config /section:asp -session.allowSessionState:"False" /commit:apphost
6. Change the time zone on a server.
%windir%\system32\tzutil.exe /s "Central Standard Time"
Note: The gacutil is not available on Windows Azure VMs on R2 server. You need to package the gacutil.exe and set its property attibute "copy to output directory" to copy always.
<Startup>
<Task commandLine="StartupEnableASP.cmd" executionContext="elevated" taskType="simple">
</Task>
</Startup>
Add the below commands to to a CMD file in a web role project and in the properties of the cmd file set copy always for the "copy to output directory" attribute.
1. To enable ASP engine on a VM/hosted service.
start /w pkgmgr /iu:IIS-ASP
2. To make APPpool run as a 32 bit application.
%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.enable32BitAppOnWin64:true /commit:apphost
3. To enable scripterrors send to browser in case of an ASP application.
%windir%\system32\inetsrv\appcmd set config -section:system.webServer/asp -scriptErrorSentToBrowser:"True" /commit:apphost
4. To set scripttimeout for an ASP application.
%windir%\system32\inetsrv\appcmd set config -section:system.webServer/asp /limits.scriptTimeOut:"00:30:00" /commit:apphost
5. To disable session state management of an ASP application.
%windir%\system32\inetsrv\appcmd set config /section:asp -session.allowSessionState:"False" /commit:apphost
6. Change the time zone on a server.
%windir%\system32\tzutil.exe /s "Central Standard Time"
7. To register 32 bit dlls on a 64-bit operating system. The use /s is to suppress the message box after successful registration of the COM component. Otherwise the Azure role to start will be hanging in management portal.
%SystemRoot%\Syswow64\Regsvr32.exe cdonts.dll /s
%SystemRoot%\Syswow64\Regsvr32.exe aspsmartupload.dll /s
8. Installing .Net 4.0 dll to GAC before converting to a TLB file for using in an ASP app on Azure. Again note /s as suppression attribute. Now the TLB file can be used in ASP with server.CreateObject("")
gacutil.exe /i Utilities.dll
%SystemRoot%\microsoft.net\framework\v4.0.30319\regasm.exe Utilities.dll /tlb:Utilities.tlb /s
8. Installing Microsoft.WindowsAzure.StorageClient.dll a .Net 4.0 dll to GAC before converting to a TLB file for using in an ASP app on Azure. Note the Microsoft.WindowsAzure.StorageClient.dll is not available on GAC of VMs in Azure so we did this to fix our problem when creating object of our custom dll from ASP on azure.
gacutil.exe /i Microsoft.WindowsAzure.StorageClient.dll
%SystemRoot%\microsoft.net\framework\v4.0.30319\regasm.exe Microsoft.WindowsAzure.StorageClient.dll /tlb:Microsoft.WindowsAzure.StorageClient.tlb /s
Note: The gacutil is not available on Windows Azure VMs on R2 server. You need to package the gacutil.exe and set its property attibute "copy to output directory" to copy always.