To develop a .NET cloud computing application, the following softwares need to be installed:
-
Microsoft Visual Studio 2010
-
Windows Azure SDK
-
Windows Azure Tool
-
Windows Azure Emulator
You can download all these softwares from http://www.microsoft.com.
The following takes Windows Azure SDK 1.6 as example to describe how to develop a cloud computing Worker role application.
Step 1: Open Microsoft Visual Studio 2010, and select New ->Project, as shown below:
Step 2: The following screen appears. Select Visual C# -> Cloud on the left-side navigation pane, and input the project name (in this example, WindowsAzureDemo) and then click OK.
Step 3: In the following screen, select Work Role, click ">" to add it into Windows Azure solution on the right-side, and then click OK.
Step 4: In the right-side Solution Explorer, manipulate the files as below:
-
Create the file startup.cmd under the WorkerRole1 project, and add the following content to the file:
start /w %windir%/system32/pkgmgr /iu:IIS-WebServerManagementTools; IIS-ManagementScriptingTools;IIS-ManagementService sc config w3svc start= auto net start w3svc %windir%\System32\inetsrv\appcmd set config /section:isapiCgiRestriction /[path='D:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll'] .allowed:True%windir%\System32\inetsrv\appcmd set config /section:isapiCgiRestriction /[path='D:\Windows\Microsoft.NET\ Framework64\v4.0.30319\aspnet_isapi.dll'].allowed:True iisreset /restart
-
Open the file ServiceDefinition.csdef, and add the following content under the Imports node:
<Startup> <Task commandLine="startup.cmd" executionContext="elevated" taskType="simple"> </Task> </Startup>
This is used to automatically configure IIS when the application starts.
Step 5: In Solution Explorer, right-click the WindowsAzureDemo project, and then select Configure Remote Desktop
Step 6: In the Remote Desktop Configuration window, select the Enable connection for all roles checkbox, create or select a certificate, specify the login credentials, and then click OK.
Remember the login credentials, as you will use them to log into the virtual machine once the virtual machine instance is created. And the certificate which contains the encrypted login credentials will need to be uploaded later by following instructions in the section called “Deploying .NET cloud computing application”.
Step 7: In Solution Explorer, right-click WindowsAzureDemo and then select Build Solution.
Step 8: After building is finished successfully, right-click the WindowsAzureDemo project, and then select Package. In the Package Windows Azure Application dialog box that appears, use the default settings and click Package. In this example, two files will be generated automatically: one is ServiceConfiguration.Cloud.cscfg and the other is WindowsAzureDemo.cspkg. These two files will need to be deployed to the virtual machine later by following instructions in the section called “Deploying .NET cloud computing application”.