[AZURE.INCLUDE mobile-service-note-mobile-apps]
[AZURE.INCLUDE mobile-services-selector-get-started]
[AZURE.TIP] If you are new to mobile development using Microsoft Azure, get started with Azure Mobile Apps instead of Azure Mobile Services; Mobile Apps gives you additional advantages.
This tutorial shows you how to add a cloud-based backend service to a universal Windows app using Azure Mobile Services. Universal Windows app solutions include projects for both Windows Store 8.1 and Windows Phone Store 8.1 apps and a common shared project. For more information, see Build universal Windows apps that target Windows and Windows Phone.
In this tutorial, you will create both a new mobile service and a simple To do list app that stores app data in the new mobile service. The mobile service that you will create uses the supported .NET languages using Visual Studio for server-side business logic and to manage the mobile service. To create a mobile service that lets you write your server-side business logic in JavaScript, see the JavaScript backend version of this topic.
[AZURE.NOTE]This topic shows you how to create a new mobile service project and universal Windows app by using the Azure classic portal. By using Visual Studio 2013 Update 3, you can also add a new mobile service project to an existing Visual Studio solution. For more information, see Add Mobile Services to an existing app.
To add a mobile service to an Windows Phone 8.0 or Windows Phone Silverlight 8.1 app project, see Add Mobile Services to an existing Windows Phone app.
[AZURE.INCLUDE mobile-services-windows-universal-get-started]
To complete this tutorial, you need the following:
- An active Azure account. If you don't have an account, you can sign up for an Azure trial and get up to 10 free mobile services that you can keep using even after your trial ends. For details, see Azure Free Trial.
- Visual Studio 2013.
[AZURE.INCLUDE mobile-services-dotnet-backend-create-new-service]
Once you have created your mobile service, you can follow an easy quickstart in the Azure classic portal to either create a new app or modify an existing app to connect to your mobile service.
In this section you will create a new universal Windows app that is connected to your mobile service.
-
In the Azure classic portal, click Mobile Services, and then click the mobile service that you just created.
-
In the quickstart tab, click Windows under Choose platform and expand Create a new Windows Store app.
This displays the three easy steps to create a Windows Store app connected to your mobile service.
-
If you haven't already done so, download and install Visual Studio 2013 on your local computer or virtual machine.
-
Under Download and run your app and service locally, select a language for your Windows Store app, then click Download.
This downloads a solution contains projects for both the mobile service and for the sample To do list application that is connected to your mobile service. Save the compressed project file to your local computer, and make a note of where you save it.
[AZURE.INCLUDE mobile-services-dotnet-backend-test-local-service-dotnet]
[AZURE.NOTE]You can review the code that accesses your mobile service to query and insert data, which is found in the MainPage.xaml.cs file.
[AZURE.INCLUDE mobile-services-dotnet-backend-publish-service]
In the Shared code project, open the App.xaml.cs file, locate the code that creates a MobileServiceClient instance, comment-out the code that creates this client using localhost and uncomment the code that creates the client using the remote mobile service URL, which looks like the following:
<pre><code>public static MobileServiceClient MobileService = new MobileServiceClient( "https://todolist.azure-mobile.net/", "XXXX-APPLICATION-KEY-XXXXX");</code></pre> <p>The client will now access the mobile service published to Azure.</p></li>
Now that the mobile service is published and the client is connected to the remote mobile service hosted in Azure, we can run the app using Azure for item storage.
[AZURE.INCLUDE mobile-services-windows-universal-test-app]
Now that you have completed the quickstart, learn how to perform additional important tasks in Mobile Services:
-
Add Mobile Services to an existing app
Learn more about storing and querying data using Mobile Services. -
Get started with offline data sync
Learn how to use offline data sync to make your app responsive and robust. -
Add authentication to your Mobile Services app
Learn how to authenticate users of your app with an identity provider. -
Add push notifications to your app
Learn how to send a very basic push notification to your app. -
Troubleshoot a Mobile Services .NET backend
Learn how to diagnose and fix issues that can arise with a Mobile Services .NET backend.
For more information about universal Windows apps, see Supporting multiple device platforms from a single mobile service.
[AZURE.INCLUDE app-service-disqus-feedback-slug]