Exercise 2: Using Start-Up Tasks to Register a COM Component
A start-up task is a command, either an executable or a script, executed prior to the start of a role instance. The command can perform set up tasks that are required to prepare the environment for the application, such as installing applications, registering COM components, configuring IIS settings, or registering performance counters.
In this exercise, you explore the use of start-up tasks to configure the environment where a service executes. To do this, you will use a sample Web application that requires a COM component to work.
Task 1 – Registering a COM Component
Many applications today still rely on functionality provided by “legacy” COM components. Moving these applications to the cloud requires that each virtual machine instance hosting the application have the necessary components installed and registered. Registration needs to be carried out upon role start up and requires administrative privileges.
In this task, you create a start-up task that registers the COM component required by the sample application.
Important: Make sure that you have launched the dependency checker to set up the lab before starting this task. The setup procedure builds the COM component required by the solution from source code in the Assets folder. Note that you need to have Visual C++ installed for this purpose.In addition, to use the COM component, the identity of the process instantiating it must have access to the directory where the component is installed. To ensure this, avoid launching the service from a location inside your user profile folder and instead, copy the project files to a folder with unrestricted permissions, for example, to a folder within the default installation location of the training kit, C:\WAPTK.