Jeff Sanders Technical Blog

I am a Microsoft employee that has worked on all aspects of the Web Stack for a long time. I hope these blogs are useful to you! Use this information at your own risk.


Earlier Posts

There was no end to end sample of how you might use the PasswordVault to store your JWT used for user authentication in Mobile Services.  I created this class to be used with your Windows Store app.


In my two previous posts I discussed how to move your table filter logic server side, and how to use Virtual tables to get different views of data.  In this blog post I will show you how to pass parameters to you read script to get different views of the data.


Building on my last post (Move Your Client Logic to the Server – Windows Azure Mobile Services) I will show you how to create a Virtual (or dummy) table to give you a different view of your TodoItem table.  This Virtual table will not contain any records however.


The Client Libraries for Windows Azure Mobile Services are powerful and allow you to embed logic within your client application.  The quickstart and sample applications give you a great overview on how to implement logic on the client to get the view of data you would like in the client application.  A different architecture for you would be to move this view logic to the server using the Server Scripting capability of Windows Azure Mobile Services so that you do not have to duplicate the client side logic for each platform that you target as a client! 


Undoubtedly when developing application using Windows Azure Mobile Services you will get unexpected results.  This guide will help you isolate and troubleshoot the most common errors that you will encounter.  This post is not intended to solve you issues but help you isolate and simplify the problem so you can dig in deeper or engage Microsoft Support for additional help.  Also see: Mobile Apps Troubleshooting
Basic Architecture
To effectively troubleshoot a problem you need to understand how Mobile Services work.  A simple breakdown of the architecture is that there is a server component (your Mobile Service URL) and a client component (your application code).
When you create your Mobile Service, we host your Service on Azure and expose an HTTPS endpoint that allows your client code to access your data stored in your Azure SQL database.
Your Mobile Service (the server component) is hosted on Azure and depends on our Azure infrastructure to bring up your Service when it is needed (if free mode… the default) and provides logging and other services like the Scheduler.
The client will issue one of five types of requests to the server.  There is a login request and four data requests.  The client communicates with the server through the REST API over HTTPS (or HTTP).  If you are using Windows, Android, iOS or any other client, those libraries simply translate the client library code into an HTTPS call to the REST API.  Understanding this API is your key to troubleshooting difficult issues!  Here is a link to the REST API documentation.  Watch Josh’s video on this API to learn how to login, create, read, update and delete data without writing any client code!
The server has a script interface for the four data operations.  You can use logging in these scripts to determine if a request gets to your server and what parameters are being passed How to: write output to the mobile service logs.  In addition you can run a Scheduler script on demand or on a schedule and there too, you can use logging to troubleshoot.  Ultimately the scripts will communicate with your Azure SQL database.  You can see your data in the DATA tab of your Mobile Service or connect to the Database through the portal and view it there.
Troubleshooting the Problem is Isolating the Problem!
You need to determine where you think the problem is; the Mobile Service infrastructure, your Mobile Service, Azure SQL or client code, and then compare what the expected result is verses what you are experiencing.  Here are some steps you can take to isolate the problem:
Can you get to your Mobile Services dashboard (https://manage.windowsazure.com/) and click on your Mobile Service?  If not, perhaps there is a connectivity or network error where you are.
Are the Mobile Services healthy?  You can go to Windows Azure Service Dashboard and see if the Mobile Services are see the status.  Click on the RSS feed icon on the right of the Mobile Services to see any news about Mobile Services.  There is a link at the top of the page to get help if the service is not healthy.


Fiddler is a powerful tool that can help you isolate problems with your Windows Azure Mobile Service.  You can quickly eliminate your client code from the equation and start troubleshooting issues with this tool.  Here is how you can quickly test to see if you can fetch data stored in your Mobile Services!


You can use an existing Azure SQL table with your Mobile Services by moving the table to the schema used by your Mobile Service.  This blog post will show you one technique to accomplish this.


When you have multiple projects in a solution (for example a Phone and Windows Store app) and you need to add a reference using nuget for each of them there are two methods you can choose from.  You can use the command line using the Package Manager Console or you can Use the Dialog.  Note: The latest version of Windows Azure Mobile Services is here: http://nuget.org/packages/WindowsAzure.MobileServices.


-

04 May 2013

Hey all… Thanks for attending the Windows Azure Mobile Services Troubleshooting talk!


I needed to access a stored procedure in the same database but for a different schema and call it from a server side script in Windows Azure Mobile Services, however I was getting this error: Error occurred executing query:  “Error: [Microsoft][SQL Server Native Client 10.0][SQL Server]The EXECUTE permission was denied on the object ‘Test’, database ‘jsanders_db’, schema ‘jsandersauthdemo’.”.  This made sense to me because I was calling across Schemas.  The script looked like this:


Just a quicky!


I struggled with getting Fiddler to work with the emulators shipped with Eclipse.  Here is a quick reference for you to get Fiddler installed so you can debug HTTP and HTTPS traffic.