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