Danh mục

Apress Introducing Dot Net 4 With Visual Studio_9

Số trang: 45      Loại file: pdf      Dung lượng: 3.52 MB      Lượt xem: 8      Lượt tải: 0    
tailieu_vip

Phí tải xuống: 16,000 VND Tải xuống file đầy đủ (45 trang) 0
Xem trước 5 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Giới thiệu NET 4.0. Tinh lựa chọn của họ và cung cấp cho họ với một lộ trình cho các phiên bản mới. Rõ ràng bản đồ toàn bộ phạm vi thay đổi, hiển thị những gì mới, những gì đã thay đổi và những gì đã ở lại cùng. Điều quan trọng, nó cung cấp rõ ràng ví dụ về thực hành tốt nhất và cho thấy làm thế nào công nghệ có thể được đưa vào làm việc.
Nội dung trích xuất từ tài liệu:
Apress Introducing Dot Net 4 With Visual Studio_9 CHAPTER 16 WINDOWS AZURE We will now define the actual value of this setting, so open ServiceDefinition.cscfg and add a4. new setting inside the ConfigurationSettings element: While we are working with ServiceDefinition.cscfg, find the element that reads5. and change it to 6. Changing the instances count tells Azure to create five instances of our application and simulates scaling our application to use five Azure nodes (you will need to set this back before deployment depending on your pricing structure). This setting can be easily amended online; note how easy it is to quickly scale up your application depending on demand. Microsoft recently announced Azure supports an API that allows you to do this programmatically. Your ServiceDefinition.cscfg should now look like Open Default.aspx.cs and enter the following code: using Microsoft.WindowsAzure.ServiceRuntime; protected void Page_Load(object sender, EventArgs e) { string GreetingString = + RoleEnvironment.GetConfigurationSettingValue(message); Response.Write(GreetingString + at + DateTime.Now.ToString()); }7. Press F5 to run the application and you should see the greeting value we defined output to the screen with the current time and date. 417 CHAPTER 16 WINDOWS AZURE Logging and Debugging When running your Azure applications locally, you can make full use of standard Visual Studio debugging facilities. However, when applications are deployed to the cloud, debugging and logging support is a bit limited at the time of writing. At the time of writing the logging APIs are in a state of flux (http://blogs.msdn.com/windowsazure/ archive/2009/10/03/upcoming-changes-to-windows-azure-logging.aspx) so expect the final version to have performance monitoring features and integration with Azure storage (see the following). Note that the RoleManager.WriteToLog() method that was present in preview versions has been removed. Testing Azure Applications We have now finished our applications development, so we need to test it. Development would be very slow if we had to deploy to the cloud each time to test it, so Microsoft provides a local version of Azure called the development fabric that simulates how our applications will function in the cloud. Before we can run Azure our application, we will need to create the development storage database (which is just a SQL Server database). This seems to be used for deployment and testing of Azure applications. It can also be quite useful for debugging Azure storage issues (discussed later in the chapter). Creating Development Storage To create development storage, open the Windows Azure SDK command prompt (on the Windows menu under the Windows Azure SDK v1.0 folder) and then enter the following command replacing INSTANCENAME with the name of your SQL Server instance (if you don’t want to use an instance just enter a dot to refer to the machine itself): DSInit /sqlinstance:INSTANCENAME After you press return, the DSInit utility will start creating the development storage database (Figure 16-4): Figure 16-4. Creation of development storage418 CHAPTER 16 WINDOWS AZURE Now press F5 to run your application and you should see an exciting screen like Figure 16-5:Figure 16-5. Hello Azure application Well done—you have created your first Azure application—but don’t close the web browser windowjust yet. Take a look at the Windows taskbar (you may have to click Show hidden icons if you are usingWindows 7) where there will be a small blue Windows Azure flag showing. Left-clicking on this will showyou the current Azure storage and development fabric status (Figure 16-6).Figure 16-6. Azure storage Now right-click on the blue flag and notice how you can shut down the development storage andfabric here as well. This time, however, select the option to show the development fabric UI, and youshould see a screen similar to Figure 16-7: 419 CHAPTER 16 WINDOWS AZURE Figure 16-7. Development Fabric UI The window is split into two panes. On the left-ha ...

Tài liệu được xem nhiều: