SlideShare a Scribd company logo
1 of 18
Using Windows Azure Web Services
in ASP.NET MVC 4 Web Applications
By Seminda Rajapaksha
Overview
• Introducing Windows Azure
• Designing and Writing Windows Azure Services
• Consuming Windows Azure Services in a Web
Application
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
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
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
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
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
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
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
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
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
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
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:
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>.cloudapp.net/<servicename>.svc
• To add service reference in the staging environment, use
http://<urlname>.cloudapp.net/<servicename>.svc
• Use the generated proxy class
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
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
Questions
The End
References:
http://www.windowsazure.com/en-
us/develop/net/tutorials/multi-tier-web-site/1-overview/
http://www.windowsazure.com/en-us/manage/services/cloud-
services/how-to-create-and-deploy-a-cloud-service/

More Related Content

Recently uploaded

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Recently uploaded (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

Featured

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 

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

  • 1. Using Windows Azure Web Services in ASP.NET MVC 4 Web Applications By Seminda Rajapaksha
  • 2. Overview • Introducing Windows Azure • Designing and Writing Windows Azure Services • Consuming Windows Azure Services in a Web Application
  • 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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>.cloudapp.net/<servicename>.svc • To add service reference in the staging environment, use http://<urlname>.cloudapp.net/<servicename>.svc • Use the generated proxy class
  • 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. 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

Editor's Notes

  1.  
  2.  
  3.  
  4. 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.
  5. 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.
  6. 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.
  7. 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.
  8.  
  9. 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.
  10. 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.
  11. 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.
  12. 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.
  13.  
  14. 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.
  15. 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.
  16. 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(&quot;operas I&apos;ve seen.&quot;, &quot;Index&quot;, &quot;Opera&quot;)&lt;/p&gt;3. Place the mouse cursor after the located code, press Enter twice, and then type the following code.&lt;form&gt;&lt;/form&gt;4. Place the mouse cursor in the FORM element code block you just created, and then type the following code.