Freigeben über


Common Tasks For Developing Windows Azure Web Role ASP.NET Web Applications Using Visual Studio 2010 – Index of How-To’s, Vol 1.

Programming Windows Azure - Programming the Microsoft Cloud

How to create and run an ASP.NET service for Windows Azure in Visual Studio 2010

  1. Launch Microsoft Visual Studio 2010 with administrator privileges. To launch Visual Studio with administrator privileges, right-click Microsoft Visual Studio 2010 and then click Run as administrator.
  2. On the File menu, click New, and then click Project.
  3. Within the New Project dialog, navigate to Installed Templates, Visual C# , and clickCloud.
  4. Click Windows Azure Project. If needed, modify the Location: field, which indicates where your solution will be stored. Click OK to close the New Project dialog.
  5. Within the New Windows Azure Project dialog, navigate to Visual C# , click theASP.NET Web Role, and then click the > symbol. This will add a web role to your Windows Azure solution. A web role provides an environment for running web sites or applications as supported by Internet Information Services (IIS) 7.0. Click OK to close the New Windows Azure Project dialog.
  6. [Optional] At this point you could compile and run the application. However, you could also customize the text displayed in the web page by modifying Default.aspx. This won’t fundamentally change the application, but it will show you how similar this application is to a traditional (non-cloud) ASP.NET application. To modify Default.aspx, open Solution Explorer. If Solution Explorer is not visible, from the View menu clickSolution Explorer. Within Solution Explorer, expand WebRole1 and double-clickDefault.aspx. Modify the Welcome to ASP.NET! text to become Welcome to ASP.NET in Windows Azure! . Save and close Default.aspx.
  7. Compile and run the service by clicking Debug from the menu and then clicking Start Without Debugging.

How to configure certificate for Compute Emulator in Visual Studio 2010

  1. Switch to your solution in Visual Studio.
  2. Right click on the web role under Roles folder in Solution Explorer and chooseProperties option.
  3. Click on the Certificates tab.
  4. Click on Add Certificate.
  5. The new row appears.
  6. Type the certificate’s arbitrary name in the Name field.
  7. Leave Store Location value LocalMachine.
  8. Leave Store value My.
  9. In the Thumbprint field click on ellipses (...), you should see list of the certificates. Locate the one you have created in previous step and click OK. Thumbprint field shows the certificate’s thumbprint.
  10. Save your work using Ctrl+S.
  11. Select and copy the thumbprint into clipboard using Ctrl+C. You will use it for configuring WIF related sections in web.config.

How to configure Windows Azure Role’s Endpoint for SSL/HTTPS in Visual Studio 2010

  1. While in the Web Role Properties page click on Endpoints tab.
  2. Click on Add Endpoint option at the top, new row appears.
  3. Type new endpoint’s arbitrary name in the Name filed.
  4. Specify Type value of Input.
  5. Specify Protocol value of SSL.
  6. Specify Public Port arbitrary value. Note: Compute Emulator cannot be configure for specific IP addresses and ports, so if the IP address and port value are unavailable the Compute Emulator will assign its own. You want to avoid this since you need exactly to know the IP address and the port as it needs to be specified in exact way in ACSv2 portal. To identify used ports on local machine open command prompt and run the following command netstat –a –n | findstr 127.0.0.1. use the port that is not listed there.
  7. In the SSL Certificate Name specify the certificate you have just configured in previous step.
  8. Save your work by using Ctrl+S.

How to grant certificate access permissions to application pool account on your local machine

  1. Click on the Windows button on the taskbar and type mmc. You should see mmc.exeappears in search results. Click on it.
  2. When the MMC console appears, click on File and then on Add/Remove Snap-in… option.
  3. In the available snap-ins list choose Certificates and click on Add > button.
  4. In the dialog box choose Computer Account option and click Next button.
  5. On the Select Computer wizard page choose Local computer: (the computer this console is running on) option and click Finish.
  6. Expand Console Root folder.
  7. Expand Certificates (Local Computer) folder.
  8. Expand Personal folder.
  9. Click on Certificates folder to list the available certificates.
  10. Locate your certificate, right click on it and choose All Tasks option and then click onManage Private Keys... option.
  11. Add Network Service account to the list under Group or user names: section and click OK button.

How to create service package for deployment to Windows Azure environment

  1. In Visual Studio’s Solution Explorer, right-click the project name (the one that’s above Roles folder) and then click Publish… .
  2. Within the Deploy Windows Azure project dialog, click Create Service Package Only, then click OK.
  3. Assuming successful compilation, Visual Studio will open a folder that contains two files created as part of the publish process. The files are ServiceConfiguration.cscfg (which we discussed earlier in this topic) and <YourProjectName> .cspkg (such as WindowsAzureProject1.cspkg). The .cspkg extension is for service package files. A package file contains the service definition as well as the binaries and other items for the application being deployed. Make a note of the path to these files, as you’ll be prompted for the path when you deploy the application using the Windows Azure management portal.