Create an app with a mobile and web client in Azure App Service



Similar documents
Using Application Insights to Monitor your Applications

Using Microsoft Azure for Students

Remote Desktop Web Access. Using Remote Desktop Web Access

Getting Started with Elastic DB Database Tools with Azure SQL

Deploying an ASP.NET Web Application to a Hosting Provider using Visual Studio

Building an ASP.NET MVC Application Using Azure DocumentDB

Getting Started with the Ed-Fi ODS and Ed-Fi ODS API

AVG Business SSO Partner Getting Started Guide

How to install and use the File Sharing Outlook Plugin

The Great Office 365 Adventure

unisys ClearPath eportal Developer 6.1 Unisys Multi-Device App Developer s Guide March

GOA365: The Great Office 365 Adventure

Lab 1: Windows Azure Virtual Machines

Deploy the client as an Azure RemoteApp program

System Administration Training Guide. S100 Installation and Site Management

Office365Mon Developer API

To install Multifront you need to have familiarity with Internet Information Services (IIS), Microsoft.NET Framework and SQL Server 2008.

HOW TO ACCESS YOUR ONEDRIVE FOR BUSINESS DOCUMENTS

What is OneDrive for Business at University of Greenwich? Accessing OneDrive from Office 365

Installing a Browser Security Certificate for PowerChute Business Edition Agent

This tutorial provides detailed instructions to help you download and configure Internet Explorer 6.0 for use with Web Commerce application.

Using Microsoft Visual Studio API Reference

Getting started with OneDrive

Veeam Backup Enterprise Manager. Version 7.0

Wavecrest Certificate

WatchDox for Mac User Guide

MultiSite Manager. Setup Guide

MultiSite Manager. Setup Guide

Introduction to Building Windows Store Apps with Windows Azure Mobile Services

IBM Information Server

Census. di Monitoring Installation User s Guide

Lab: Create Your Own Homepage! This exercise uses MS Expression Web as a Web Page creation tool. If you like you

Installing OGDI DataLab version 5 on Azure

Backing Up and Restoring Microsoft Exchange Server Cloud Attached Storage. August 2012 Version 3.2

SQL Server 2005: Report Builder

Cloud Powered Mobile Apps with Azure

Cloud Attached Storage

Lab - Building an Internet of Things Application Hands-On Lab

Shavlik Patch for Microsoft System Center

SAV2013: The Great SharePoint 2013 App Venture

Walkthrough: Creating and Using an ASP.NET Web Service in Visual Web Developer

Windows Server Update Services 3.0 SP2 Step By Step Guide

DreamFactory on Microsoft SQL Azure

Colligo Manager 6.2. Offline Mode - User Guide

OET Cloud Services Getting Started Guide

Download and Launch Instructions for WLC Client App Program

Adobe Summit 2015 Lab 712: Building Mobile Apps: A PhoneGap Enterprise Introduction for Developers

LMS 365 Learning Module Builder Add-in Installation Guide VERSION x

Kony MobileFabric Messaging. Demo App QuickStart Guide. (Building a Sample Application

4.0 SP1 ( ) November P Xerox FreeFlow Core Installation Guide: Windows Server 2008 R2

ScheduleOne - Help Guide

Install SQL Server 2014 Express Edition

Backing Up and Restoring Microsoft Hyper-V Server Virtual Machines. Cloud Attached Storage. February 2014 Version 4.0

Desktop Surveillance Help

Lync Online Deployment Guide. Version 1.0

Hands on Lab: Building a Virtual Machine and Uploading VM Images to the Cloud using Windows Azure Infrastructure Services

Cloud Services MDM. Control Panel Provisioning Guide

WordCom, Inc. Secure File Transfer Web Application

Installing and Configuring vcloud Connector

ECA IIS Instructions. January 2005

Made Easy Windows Sync App Tutorial

ATTENTION: End users should take note that Main Line Health has not verified within a Citrix

With Wakanda Cloud, you can publish a solution you created with Wakanda on the cloud. Wakanda Cloud allows you to:

UP L18 Enhanced MDM and Updated Protection Hands-On Lab

Cloud Services ADM. Agent Deployment Guide

User Manual. Onsight Management Suite Version 5.1. Another Innovation by Librestream

Table of Contents. Welcome Login Password Assistance Self Registration Secure Mail Compose Drafts...

Using Windows Azure Mobile Services to Cloud-Enable your Windows Store Apps in C#

BarTender Print Portal. Web-based Software for Printing BarTender Documents WHITE PAPER

Using GitHub for Rally Apps (Mac Version)

Microsoft Office 2010

Active Directory Management. Agent Deployment Guide

Exploring Manual and Automatic Database Backup Using Microsoft Azure Storage

Migrating Trend Micro Mobile Security for Enterprise (TMMS) 8.0 to TMMS 9.0

Experience SAP HANA Cloud Portal

isupplier PORTAL ACCESS SYSTEM REQUIREMENTS

ICONICS Using the Azure Cloud Connector

Outlook Web App User Guide

Administering Jive for Outlook

Infor Xtreme Browser References

1. Right click using your mouse on the desktop and select New Shortcut.

Software Installation Requirements

How to add your Weebly website to a TotalCloud hosted Server

Guide to Setting up Docs2Manage using Cloud Services

Colligo Manager 6.0. Offline Mode - User Guide

Avalanche Site Edition

Learn how to create web enabled (browser) forms in InfoPath 2013 and publish them in SharePoint InfoPath 2013 Web Enabled (Browser) forms

Microsoft Azure - Week6 Tuesday -

Sharp Remote Device Manager (SRDM) Server Software Setup Guide

Advantage for Windows Copyright 2012 by The Advantage Software Company, Inc. All rights reserved. Client Portal blue Installation Guide v1.

Kentico CMS 7.0 Windows Azure Deployment Guide

Configuring Network Load Balancing with Cerberus FTP Server

Configuring user provisioning for Amazon Web Services (Amazon Specific)

SAP BusinessObjects Business Intelligence Platform Document Version: 4.1 Support Package Business Intelligence Launch Pad User Guide

ProSystem fx Document

Microsoft Office 365 Exchange Online Cloud

Kentico CMS for.net User Groups

Transcription:

Page 1 of 7 Create an app with a mobile and web client in Azure App Service Mobile Apps in Azure App Service offer a highly scalable, globally available mobile application development platform for Enterprise Developers and System Integrators that brings a rich set of capabilities to mobile apps. Mobile Apps help you build native and cross platform apps, connect to your enterprise systems, connect to SaaS APIs easily, build offline-ready apps with sync and push Notifications to millions in seconds. In this lab, you create an App Service API app, deploy an ASP.NET Web API to the API app, and consume the API app from an AngularJS Web client. This lab includes the following tasks: Create a App Service Mobile App Portal Overview of the Sample application Publish a ContactList Web Api Publish a ContactList web client UI Create a App Service Mobile App in Portal In this section, you will create a Azure App Service Mobile App backend. 1. Log into the Azure Portal. In the top left the window, click +NEW. 2. Click Web + Mobile and then click Mobile App. 3. Enter a unique App Service Name. Select Subscription. Create a new Resource group named contactlisting. Resource Group. Create a new App Service Plan in the region you want to run the lab in. 4. Click Create. Overview of the Sample application

Page 2 of 7 The code that you'll deploy to an API app and a web app for this tutorial is in the Azure-Samples/app-service-api-dotnetcontact-list GitHub repository. The ContactsList Visual Studio solution includes the following projects used in this tutorial: ContactsList.API - An ASP.NET Web API project that returns a list of names and email addresses. The initial call to the Get method returns 3 hard-coded contacts, then subsequent calls to Put, Post, and Delete methods save changes in a local JSON file. ContactsList.Angular - An AngularJS client, for demonstrating CORS support. 1. Download the sample application: Download the solution from /source/contactlist. 2. You can Download a.zip file or clone the repository on your local machine. 3. Open the ContactsList solution in Visual Studio 2015 or 2013. 4. Build the solution to restore the NuGet packages. Use Swagger metadata and UI In this section of the tutorial you take a look at the generated Swagger 2.0 metadata, and then you try out a test UI that is based on the Swagger metadata. 1. Set the ContactsList.API project as the startup project. 2. Press F5 to run the project in debug mode. The browser opens and shows the 403 Forbidden page. 3. In your browser address bar, add swagger/docs/v1 to the end of the line, and then press Return. (The URL will be http://localhost:{port-num}/swagger/docs/v1.) 4. This is the default URL used by Swashbuckle to return Swagger 2.0 JSON metadata for the API. If you're using Internet Explorer, the browser prompts you to download a v1.json file. If you're using Chrome or Edge, the browser displays the JSON in the browser window. 5. In your browser address bar, add swagger to the end of the line, and then press Return. (The URL will be http://localhost: {port-num}/swagger.) 6. When the Swagger UI page appears, click Contacts to see the methods available.

Page 3 of 7 Publish a ContactList Web Api In this section you use Azure tools that are integrated into the Visual Studio Publish Web wizard to create a new API app in Azure. Then you deploy the ContactsList.API project to the new API app and call the API by running the Swagger UI again, this time while it runs in the cloud. 1. In Solution Explorer, right-click the ContactsList.API project, and then click Publish. 2. In the Profile step of the Publish Web wizard, click Microsoft Azure App Service. 3. In the dialog box, Select Existing Web App. Select the App Service which was created for Web API and Click OK which will donwload the publish profiles of the particular web app and click on Publish.

Page 4 of 7 4. Once the application is created, Add "swagger" to the URL in the browser's address bar, and then press Enter. (The URL will be http://{apiappname}.azurewebsites.net/swagger.) The browser displays the same Swagger UI that you saw earlier, but it is now running in the cloud. Try out the Get method, and you see that you're back to the default 3 contacts, because the changes you made earlier were saved in a local file; any changes you make now will be saved in the file system of the Azure API app. 5. Click Browse > API Apps > {your new API app}. 6. Click Settings, and then in the Settings blade find the API section and click API Definition. The API Definition blade lets you specify the URL that returns Swagger 2.0 metadata in JSON format. When Visual Studio creates the API app, it sets the API definition URL to the default value that you saw earlier, which is the API app's base URL plus /swagger/docs/v1. Publish a ContactList Web Client UI This tutorial shows how to consume an API app from JavaScript code in a website that is served from a different domain than the API app. The sample client uses AngularJS.

Page 5 of 7 In the ContactsList sample application, the ContactsList.Angular project is a simple AngularJS client for the ContactsList.API Web API project. 1. In Visual Studio, open the project ContactsList.Angular > index.html. angular.module('myapp', []).controller('contactlistctrl', function ($scope, $http) { $scope.baseurl = 'http://localhost:51864'; The AngularJS JavaScript code that calls the API is in the index.html file in the ContactsList.Angular project. The code defines the functions and adds them to the $scope object, as shown here where the API's Get method is defined as $scope.refresh() 2. Run the AngularJS project locally: The code calls $scope.refresh() method when the page loads (at the end of of the snippet shown above) and is wired up to the Refresh button in the UI. Note: These instructions work for Internet Explorer and Edge browsers because these browsers allow cross-origin JavaScript calls from and to http://localhost URLs. If you're using Chrome, start the browser with the --disable-websecurity switch. If you're using Firefox, skip this section. 3. Set the ContactsList.API and ContactsList.Angular projects as startup projects, with ContactsList.API starting before ContactsList.Angular by right clicking on the Solution, opening the properties, and set both projects to Start. 4. Press F5 to start the projects. 5. The AngularJS UI displays the contacts that are stored locally, and you can use the UI to add and delete contacts. 6. Change the AngularJS project to point to the Azure API app. In the ContactsList.Angular project, open index.html. Comment out the line that sets baseurl to the localhost URL, uncomment the line that sets baseurl to an azurewebsites.net URL, and replace the placeholder with the actual name of the API app you created earlier. If you named the API app ContactsListAPI, the code now looks like the following example. $scope.baseurl = 'https://contactslistapi.azurewebsites.net'; //$scope.baseurl = 'http://localhost:51864';

Page 6 of 7 Deploy the ContactsList.Angular project to the web app 1. Before the solution will work when running against Azure you must enable CORS on the API App. 2. Open the API App that you created earlier in the Azure Management Portal, within SETTINGS click CORS. 3. In the ALLOWED ORIGINS section add * and click Save on the toolbar. 4. In Solution Explorer, right-click the ContactsList.Angular project, and then click Publish. 5. Click the Microsoft Azure web App. Create a new Web App with the final app url along with the app settings like Subscription, Resource Group, App Service Plan and click Create which will create a Web App and download the deployment settings details 6. Click the Settings tab. 7. Expand File Publish Options, and then select Remove additional files at destination. Normally when you deploy a web project to an existing App Service web app you don't want the "remove additional files" option because any changes are typically updates or new files. In this case you're deploying a different project to the same web app, so there are likely to be many files from the earlier deployment that aren't needed in the new one. 8. Click Publish.

Page 7 of 7 Test the Mobile and Web Apps 1. Refresh the local client now that it has been updated to point to the API in Azure. Summary By completing this lab you have learned how to: Create an Azure App Service API backend Use the same underlying API App for a web app