Windows Phone 8.1 uses Azure mobile services to customize the controller

Source: Internet
Author: User

In the development of Windows Phone 8.1, you want to move your servers and databases to Azure.

However, Windows Phone 8.1 cannot directly add WCF service references and needs to rest the WCF rest. I feel a little trouble.

1. First go to your Azure mobile service. Download Mobile Service Project

2. In the Mobile Service Project Controllers folder, right-click, add, Controller, select Azure Mobile Service Custom Controller

3. A name, for example, we're named Accessdb.

4. In mobile service, we have access to the controller through the method of URL, there are many ways, such as post, Put,delete,moblie service according to the way of access and the number of parameters to determine the method of the server to call

For example:

5. Run the mobile service project, and we can test our own method of writing.

7. In the Windows Phone 8.1 project, right-click the NuGet package. Find windowazure.mobileservices Online, install complete and add appropriate references to your project

8. Add a mobileserviceclient in App.xmal.cs this is the 0.0 that you copied from the first picture.

When you are debugging locally, comment out the following mobileserviceclient and keep the localhost:59225 above, relative, if you have already moved the mobile Service is posted on Azure to comment out the above mobileserviceclient

9. We can call the method we define through this mobileserviceclient

For example Var re= await App.MobileService.InvokeApiAsync ("Accessdb", system.net.http.httpmethod.get,null);

The first parameter, ACCESSDB, is the name of our controller.

The second parameter is a specific access method

The third parameter is the parameter to pass in, there are no arguments, so give a null

If there are arguments, we can use dictionary<string,string> to pass in, key: The parameter name of the method value: the argument to pass in

Windows Phone 8.1 uses Azure mobile services to customize the controller

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.