Get started with Mobile Services
Create a new mobile service
Follow these steps to create a new mobile service.
Log into the Management Portal. At the bottom of the navigation pane, click +NEW. Expand Compute and Mobile Service, then click Create.
This displays the Create a Mobile Service dialog.
In the Create a Mobile Service page, select Create a free 20 MB SQL Database, select .NET runtime, then type a subdomain name for the new mobile service in the URL textbox. Click the right arrow button to go to the next page.
This displays the Specify database settings page.
As part of this tutorial, you create a new SQL Database instance and server. You can reuse this new database and administer it as you would any other SQL Database instance. If you already have a database in the same region as the new mobile service, you can instead choose Use existing Database and then select that database. The use of a database in a different region is not recommended because of additional bandwidth costs and higher latencies.
- In Name, type the name of the new database, then type Login name, which is the administrator login name for the new SQL Database server, type and confirm the password, and click the check button to complete the process.
You have now created a new mobile service that can be used by your mobile apps.
Download the mobile service and app to your local computer
Now that you have created the mobile service, download projects that you can run locally.
Click the mobile service that you just created, then in the Quick Start tab, click iOS under Choose a platform and expand Create a new iOS app.
On your Windows PC, click Download under Download and publish your service to the cloud. This downloads the Visual Studio project that implements your mobile service. Save the compressed project file to your local computer, and make a note of where you saved it.
On your Mac, click Download under Download and run your app. This downloads the project for the sample To do list application that is connected to your mobile service, along with the Mobile Services iOS SDK. Save the compressed project file to your local computer, and make a note of where you saved it.
Test the mobile service
The mobile service project lets you to run your new mobile service locally. This makes it easy to debug your service code before you even publish it to Azure.
On your Windows PC, download your personalized server project, extract it, and then open it in Visual Studio.
Press the F5 key to rebuild the project and start the mobile service locally. A web page is displayed after the mobile service starts successfully.
Publish your mobile service
After testing the client app against the local mobile service, the final stage of this tutorial is to publish the mobile service to Azure and run the app against the live service.
This procedure shows how to publish your mobile service by using Visual Studio tools. You can also publish your .NET backend mobile service by using source control. For more information, see Store project code in source control.
In Solution Explorer, right-click the mobile service project, click Publish, then in the Publish Web dialog box click Azure Mobile Services.
Sign in with your Azure account credentials, select your service from Existing Mobile Services, and click OK. Visual Studio downloads your publish settings directly from Azure.
Click Validate connection to verify that publishing is correctly configured, then click Publish.
After publishing succeeds, you will again see the confirmation page that the mobile service is up and running, this time in Azure.
Run your new iOS app
The final stage of this tutorial is to build and run your new app.
Browse to the location where you saved the compressed project files, expand the files on your computer, and open the project file using Xcode.
Press the Run button to build the project and start the app in the iPhone emulator.
In the app, type meaningful text, such as Complete the tutorial and then click the plus (+) icon.
This sends a POST request to the new mobile service hosted in Azure. Data from the request is inserted into the TodoItem table. Items stored in the table are returned by the mobile service, and the data is displayed in the list.
This shows how to run your new client app against the mobile service running in Azure. Before you can test the iOS app with the mobile service running on a local computer, you must configure the Web server and firewall to allow access from your iOS development computer. For more information, see Configure the local web server to allow connections to a local mobile service.
Learn how to perform additional important tasks in Mobile Services: