Session : Using windows azure web services in mvc 4 web applications at Sri Lanka .NET Forum


Published on

Sri Lanka .NET Forum September session

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Execution Models. Provides three differentexecution models—virtual machines(VMs), web applications, and cloud services, for running applicationso Windows Azure Identity Management. Includes Windows Azure Active Directory and AccessControl services to help manage identities, authentication, and authorization in a webapplication.o Data Management. Includes services to host and manage relational database and Blob contento Business Analytics Solutions. Includes services that helps perform business information analysis byusing SQL Server Reporting Services and Apache Hadoop. Business analytics solutions support allthe data stores distributed across multiple Windows Azure data centers.o Networking Services. Includes services that provide networking capabilities to securely connectmultiple services in Microsoft data centers.o Messaging with Service Bus. Includes services that enable applications to communicate onWindows Azure.o Media Management. Includes services that bring content geographically closer to users and helpstore large volumes of content outside the web application. Storing content outside theapplication helps improve the performance of the application.
  • Question: What are the benefits of using Windows Azure cloud services?Answer: You can use Windows Azure cloud services to enable Microsoft to manage the entire application. If the application fails on the cloud, Windows Azure cloud services allow you to move the application to other VMs. The following list summarizes the benefits of cloud services:Cloud services provide administrative access to the VM of your application. This access allows you install software that your application needs.Cloud services offer both web-role and worker-role VMs, which is better for multi-tier applications that need separate VMs for their business logic.Cloud services provide separate staging and production environments that allow developers to fully test the application before delivery to ensure that the application is fully functional.Cloud services support the use of Windows Azure Virtual Network and Windows Azure Connect.
  • Question: What is the key benefit of using Windows Azure web applications?Answer: You can use Windows Azure web applications to:Automate the process of deploying applications to different hosting servers.Configure the hosting VM.Eliminate the need to program deployment scripts to copy files amongst web servers. You can describe the scenarios that require developers to host web applications on Windows Azure.
  • Question: What are the benefits of using SQL Azure?Answer: SQL Azure:Allows you to deploy relational database solutions on the Windows Azure platform.Increases the availability and scalability of applications.Reduces the need for expensive hardware.SQL Azure services use Azure Storage to store the database files for the SQL Server VM. This increases the scalability and availability of your web application and allows you to access the files stored in the Azure Storage.
  • Question: Which project template should you use to create WCF services?Answer: You can use the web role project template to create WCF services, because this template facilitates end user access and interactions by using HTML output.You can elaborate about how the Windows Azure Visual Studio template helps simplify the process of developing web applications.
  • Question: Why should you test the service code, before deploying the service on Windows Azure?Answer: Testing the web service code helps ensure that the service works, before uploading the service on Windows Azure. Windows Azure charges customers based on the usage of the platform. Therefore, you can save money by testing locally first. You can describe how the Windows Azure emulator provides the platform environment for testing the functionalities of applications and services.
  • Question: When should you use the RoleEntryPoint class?Answer: You should use the RoleEntryPoint class to add logic to web services whenyou host the application on Windows Azure.You can provide some details on how to use the ASP.NET life cycle method, in combination with the Windows Azure life cycle method.
  • Question: When should you use the ServiceConfiguration.cscfg file?Answer: You should use the ServiceConfiguration.cscfg file to define the number of instances that you need, to host a service.You can elaborate on how the two configurations files help configure the instance for hosting an application. You can also describe how the Packaging tool helps automate the process of generating the package and uploading the package on Windows Azure.
  • Question: What is the key difference between deploying a service in the production environment and deploying a service in the staging environment?Answer: The key difference lies in the URL that is defined to call the services. The difference between calling WCF services in an MVC application and calling WCF services in an ASP.NET application lies in the URL. The URL differs based on the environment in which you deploy the service.
  • Question: What is the commonly used data format used to communicate with WCF Services, from jQuery?Answer: The JavaScript Object Notation (JSON) data format is the commonly used data format used to communicate with WCF Services, from jQuery. JSON is a data format that facilitates requests and responses between client and server systems.
  • In this example, the web service is hosted within the ASP.NET web application. You can also call a web service hosted on another web server or on Windows Azure using jQuery. However, calling web services hosted on other web servers requires a different service URL.Preparation StepsLog on to the virtual machine, 20486A-SEA-DEV11, with the user name, admin, and the password, Pa$$w0rd.Start File Explorer.Navigate to Allfiles (D):\Democode\Mod13\OperasWebSiteDouble-click OperasWebSite.sln.Enable the Allow NuGet to download missing packages during build option in Package Manager.Note: In Hyper-V Manager, start the MSL-TMG1 virtual machine if it is not already running.Demonstration Steps1. In the Solution Explorer pane of the OperasWebSite – Microsoft Visual Studio window, under OperasWebSite, expand Views, expand Home, and then click Index.cshtml.2. In the Index.cshtml code window, locate the following code.@Html.ActionLink("operas I've seen.", "Index", "Opera")</p>3. Place the mouse cursor after the located code, press Enter twice, and then type the following code.<form></form>4. Place the mouse cursor in the FORM element code block you just created, and then type the following code.
  • Session : Using windows azure web services in mvc 4 web applications at Sri Lanka .NET Forum

    1. 1. Using Windows Azure Web Services in ASP.NET MVC 4 Web Applications By Seminda Rajapaksha
    2. 2. Overview • Introducing Windows Azure • Designing and Writing Windows Azure Services • Consuming Windows Azure Services in a Web Application
    3. 3. Introducing Windows Azure • What Is Windows Azure? • Benefits of Hosting Services in Windows Azure • Benefits of Hosting Web Applications in Windows Azure • Windows Azure Storage Services
    4. 4. What Is Windows Azure? Windows Azure is an open and flexible application development platform that: • Supports businesses of various sizes • Helps reduce the effort to develop scalable web applications • Decreases development costs Windows Azure provides the following categories of services: • Execution Models (VMs, web applications, and cloud services) • Windows Azure Identity Management • Data Management • Business Analytics Solutions • Networking Services • Messaging with Service Bus • Media Management
    5. 5. Benefits of Hosting Services in Windows Azure Characteristics of hosting services on Windows Azure: • Windows Azure cloud services use a role-based model that includes a web role VM and a worker role VM • You need not create the VM for the role-based model • You need to upload the configuration file on the staging environment to direct Windows Azure about how to configure the application
    6. 6. Benefits of Hosting Web Applications in Windows Azure Hosting web applications in Windows Azure: • Is similar to hosting services, because web applications also require using VMs • Provides full access to the IIS instance • Automates the process of deploying applications to different hosting servers • Simplifies the process of deploying additional hosts to support an application
    7. 7. Windows Azure Storage Services Windows Azure provides storage services, such as: • Azure Storage: • Is also called binary large object(Blob) service • Stores objects or file content relevant to web applications • Provides a unique URL to access content • SQL Azure: • Is a relational database service • Increases the availability and scalability of web applications • SQL Database: • Helps maintain a set of VMs that allow hosting a database • Increases the availability of web application content
    8. 8. Designing and Writing Windows Azure Services • Windows Azure Visual Studio Project Templates • Coding a Web Service • The Life Cycle of a Service • Deploying a Web Service
    9. 9. Windows Azure Visual Studio Project Templates You can create applications by using the following project templates: • Windows Azure project: • Facilitates role-based projects • Includes service definition and service configuration files • Web role project: • Provides templates for the following web roles: • ASP.NET • ASP.NET MVC4 • ASP.NET MVC3 • ASP.NET MVC2 • WCF Service • Silverlight Business Application • Worker role project: • Supports background processing
    10. 10. Coding a Web Service To code a web service: 1. Create a WCF Service Web Role project 2. Modify the interface file 3. Modify the service file 4. Test the functioning of the service
    11. 11. The Life Cycle of a Service The RoleEntryPoint class: • Helps define the following methods that Windows Azure hosts call, based on the development stage of the application: • OnStart • OnStop • Run • Helps define the functions that add logic to services
    12. 12. Deploying a Web Service Two files help control the Windows Azure instance that runs the application: • The ServiceDefinition.csdef file: • Helps define roles for your application • The ServiceConfiguration.cscfg file: • Helps configure the instance assigned for your application • Directs Windows Azure on how to configure the hosting environment
    13. 13. Consuming Windows Azure Services in a Web Application • Calling a Windows Azure Service Using Server-Side Code • Calling a Windows Azure Service Using jQuery • Demonstration:
    14. 14. Calling a Windows Azure Service Using Server- Side Code To call a web service in a Windows Azure web application: • Add the service reference in your application: • To add service reference in the production environment, use http://<urlname><servicename>.svc • To add service reference in the staging environment, use http://<urlname><servicename>.svc • Use the generated proxy class
    15. 15. Calling a Windows Azure Service Using jQuery To enable the jQuery ajax function to call WCF services: • Configure the services to accept POST requests in the JSON data format • Use the ajax function to submit requests to WCF services • Specify parameters such as type, url, contentType, and dataType • Specify the ServiceSucceeded callback function as a parameter
    16. 16. Demonstration: In this demonstration, you will see how to: 1. How to create a service 2. Host it on Windows Azure 3. Access it from MVC application
    17. 17. Questions
    18. 18. The End References: us/develop/net/tutorials/multi-tier-web-site/1-overview/ services/how-to-create-and-deploy-a-cloud-service/