I was following the Microsoft Azure documentation to integrate my Xamarin Forms app with azure mobile services. I defined a data connection, used easy tables to define some custom tables and everything was working as expected with the mobile client.
Today I wanted to extend my backend functionality and also enable file storage. I followed the instructions found here and as soon as I created a new .NET server backend project with a StorageController and published it to azure, the entire easy table api stopped working. All calls from the mobile client fail with the following error:
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
This happens for all mobileClient.GetTable<SomeEntity>().SomeOperationAsync() calls.
My guess is that publishing the custom backend overwrote the online generated easy tables api... unfortunately I don't have enough experience with the azure cloud to figure out where I made a mistake. Is there any way of getting the auto generated easy tables api to also work with file storage?
As Mimi noted in the comments, Easy Tables is only available for the supplied Node backend, deployed from the portal. If you are using your own code and publishing that, Easy Tables and Easy API will be disabled.
Related
Can anyone please point out any benefits of using Azure Mobile services vs using a plain Azure app service / clean web api? For a starter / project type for a backend mobile solution.
I have somewhat mixed feelings on why I would want to use Azure Mobile Services.
As far as I see on Azure Mobile services you have an easier way of authenticating, you can use the notifcations hub more easily
and you have the different "built-in" ways of handling data (table storage etc).
Usually you would want some custom logics, user registration and handling when users register to your backend and you would like a more solid way of handling
and storing the data not privided by the OOTB datastorage.
You might also have another preference than using the /Table/ odata-endpoint you get with it or end up doing lots of logics to make your DAO's return data in properly for the OData endpoints.
All these things; IMO makes it more difficult to make the API/backend clean when using Azure Mobile services rather than a simple Web API with OData endpoints and swagger documentet API that can be used in a mobile-app just as easy.
Implementing / handling authentication and notifications ++ in Web Api ain't that diffucult nor time consuming.
So my problem Azure Mobile services is that it tends to fine for dev / prototyping and testing, but it might get really messy really fast when developing a proper backend.
Any thoughts and reasons why one should choose one instead of the other?
Think of Azure Mobile Services as V1 and App Service/Mobile App as V2. While Microsoft hasn't announced that Mobile Services will be phased out in the near future, if you start a new project, you should definitively look at App Service.
due to the fact that many people are confused about wether to take Web API or Web App or something different. They are going to put it all under one name. The underlying technology will be the same "i think".
But now you'll have in your portal the opportunity to add mobile push notifications, or add your swagger api definitions.
So when you're goint to stick with App Services you're not going to limit yourself.
Even when you're going to take Web Api you'll get all the functions as if you would take an App Service (if i'm correct).
*Edit: I looked it up in the portal. As I said, my old Web App Projects have the same settings as Web Api projects. So you don't need to decide anymore which kind of project you're taking. You get all the benefits out of the App Service.
I have created mobile app and wanted to use Easy Table and Easy APIs. However whenever I go to that location it shows "Unsupported Service".
Below is the image link of my azure account console.
Thanks in advance.
Easy Tables and Easy APIs are (currently) only supported for Node (Mobile Apps or Migrated Mobile Service) applications, not for .NET applications.
Please see the following thread for more details https://social.msdn.microsoft.com/Forums/silverlight/en-US/07ee8c8a-a2fc-47ad-aca4-2ec4b5e8ac4a/enabling-mobile-extension-for-your-app-runs-forever?forum=azuremobile
You can use Easy Tables with a .Net backend. I ran into the same problem following the Quick Start steps posted by Microsoft. What you want to do is delete your application in the portal, create a new one, setup the database, then click Easy tables. It will initialize for you using the database you created.
Do not click on any Quick Start links.
I'm trying to access an Azure DocumentDB database from a universal app I'm developing.
I've created a short sample of code that accesses my database based on the following sample:https://github.com/Azure/azure-documentdb-net/blob/master/tutorials/get-started/src/Program.cs
I've put that in a Console Application and it works fine.
Now, just moving this code to my universal app doesn't work as the Microsoft.Azure.Documents.Client.dll cannot be added to the references of the universal app (not targeting the same Framework).
So, I've created a portable class Library that would provide the database access to my solution. I've tried to install Microsoft.Azure.Documents.Client.dll through NuGet, which didn't work. So I've manually added the reference which did seem to work.
But, when trying to compile the code, I get an error on this line:
_client = new DocumentClient(new Uri(_endPointUrl), _authorizationKey);
Error:
CS7069 Reference to type 'SecureString' claims it is defined in 'mscorlib', but it could not be found MyProject.StorageManager
So it looks like it didn't like the .dll either.
Here's where I am, it seems that each project type in which the documentDB code works cannot be used by an universal app.
Am I missing something?
The DocumentDB .NET SDK does not work from a store application, yet. This is something we're working on providing.
For now, there are two approaches you can consider
1) use a Middle tier to access DocumentDB (either Azure Mobile Apps, or your own Web Api)
2) use the JavaScript client SDK to talk to DocumentDB directly from the app (but you need to have a service that generates resource tokens for the client to use as using master key on the client is not supported for security reasons).
I am currently doing some research for the development of a mobile application for our company that should support offline data sync (on an iPad). We have explored many possibilities including PhoneGap/Cordova, Xamarin and simply native iOS development. Xamarin, for many different reasons, seems to be our best choice, so my question will assume we will develop in Xamarin.
I was looking into a library for managing offline data synchronization and the most obvious solution is Microsoft Azure MobileServices. However, my company is Canadian, and apparently it's hard to trust (legally) our data to clouds based in the US. Since we already deployed internally our WebApi on our intranet, I figured there was probably a way to point the MobileServices library to our own WebApi. I have read about the Azure Hybrid Connection possibility, but our data still conveying through Microsoft servers might not be a possibility. So, my question is this:
Is there a way to configure the Microsoft.WindowsAzure.MobileServices Client library to point directly to our intranet, RESTful WebApi backend, without going through any Microsoft Azure servers ?
I understand that, in order to be able to use the Client librairies seamlessly, we probably would have to adapt our WebApi to implement the necessary .net Backend interfaces. I'm mostly wondering if it's even possible as the MSDN documentation on the libraries all seem to point to direct connections to their servers (no possibilities to configure your own connection strings) and all instructions redirect you to their Azure Mobile Services website.
Thank you.
If you look at the API for your mobile client, you'll notice that the Azure Mobile Services Client SDK only cares about two things:
new AzureMobileClient( url, appkey)
...where it's hosted shouldn't be a concern. Everything else is just configuration.
If you want to host the Azure Mobile Services Backend on your own servers, technically you could do this, but there are likely a few caveats. Microsoft has announced that they will be launching a Canadian Azure data center, but we won't see it until 2016.
In the meantime, here's how you can host the services locally. Note that I have not tried to emulate all of the features of Azure Mobile Services (aka Zumo) so your mileage (or kilometerage) will vary.
Hosting Locally:
From a technical feasibility, you absolutely can run the services locally. I know this because you can create the Azure Mobile Services Backend project from within Visual Studio and run it locally for development purposes. This is what our development team does for testing their mobile applications.
Note that you can create the Azure Mobile Service backend directly from within Visual Studio: New Project -> Cloud -> Azure Mobile Service. You can also download the exact same template (pre-configured with your URL and ApplicationKey) directly from the Azure dashboard: Create -> Mobile Service.
Obviously, if you're hosting it on your server it will be up to you to configure and use a proper SSL certificate for your site.
ZUMO Permissions:
By default, the security roles on the server are turned off. So if you're locking down any of your methods using the [AuthorizeLevel] attribute these settings will be ignored at runtime. If you need to enable this feature you can do so by modifying the WebApiConfig.Register() method and marking the site as self-hosted: config.SetSelfHosted(true).
Configuration:
From a configuration perspective, the Azure Mobile Service dashboard provides several tabs for configuring Identity, Push Notifications, Connection Strings and App Settings. Sadly, you won't have a dashboard, but all of these settings have a corresponding value in the local web.config. Any value you provide here is automatically overwritten in Azure, but they're used when running locally.
The minimum settings you'll need to configure are listed here. The ApplicationKey you can distribute with your ZuMo client, but the MasterKey is for the Admin authorization level so you'll want to keep that secret. The MobileServiceName is used by the EntityFramework for your database schema and what appears in the URL of your site.
<add key="MS_MobileServiceName" value="myzumosite" />
<add key="MS_MasterKey" value="masterkey" />
<add key="MS_ApplicationKey" value="appkey" />
Values that start with a MS_ prefix map to corresponding values in the Azure Portal. MS_GoogleClientID and MS_GoogleClientSecret map to the Google Identity values in the dashboard, for example.
Any other value in the AppSettings node is immediately accessible via the ApiServices.Settings property and corresponds to the Settings node in the Azure dashboard.
Database connection strings continue to exist in the connectionStrings node. The same is true for azure notification hub.
Database:
Obviously, the database you configure will be up to you as well. Permissions and User accounts are also obvious. There may be some minor differences between the SQL Azure syntax for Entity Framework database migration scripts that you'll need to worry about. (I've discovered the database migration scripts don't work from the Package Manager, but they do work when the database scripts are run when your website starts)
Caveats:
You will not have a nice dashboard for monitoring performance of your site, reviewing logs or changing runtime settings
You will not be able to scale out your site immediately; Scaling and deployment will be your problem
Deployment configuration is your responsibility (Project -> Publish won't be available unless you configure it)
Not sure if you'll be able to use Azure Active Directory as an authentication scheme, though from the sounds of it that won't be a concern. You can write your own authentication providers: Microsoft's Zumo library only supports a handful, but the underlying Owin.Security package that Microsoft uses supports several dozen systems!
Your site will need to be publically visible to your mobile clients
Push Notifications should work, but you will be using Azure's notification hub for this.
I have no idea where ApiServices.Log will go
The easiest path to take would be to:
Create the Mobile Service in Azure to get the notification hub and settings preconfigured
Download the starter site from the dashboard
Configure the web.config as mentioned here.
It's not possible to simply configure WAMS Client library to work with your own WebApi Backend.
But WAMS library is available at github, so I'm sure you can reuse a lot of code from the WAMS project, especially if you want to use a PCL project.
To route your data securly through Azure, you could think about setting up express route. Additionally, for last weeks update, it's possible to apply a custom domain to the WAMS Backend, including your own certificate to secure your connection.
I'm new to Azure Mobile Services so this may be a stupid question, but I like the look of working with the client SDK especially the offline sync framework. (I haven't seen any other offline client sync frameworks in c# that would work with Xamarin)
But unfortunately I am not building the API and instead I'm working against an existing web API which cannot be changed or moved to azure hosting.
Is this scenario possible and has anyone got this working? If so, are there any standards that my API would need to conform to (above a standard asp.net web api with correct http verbs)
Right now, the client SDK is hard coded to only make calls to <mobile service url>/table/, etc. The team is looking at options of letting the client SDK consume other endpoints, but that will be awhile yet.
You could possibly do this using an HttpHandler, and changing any outgoing HTTP request to another URL. (IE. look for /table/tablename and redirect it to your custom path) But that would get pretty messy at this point.
Its also possible to wrap the call to the API from the within the mobile services SDK as well. It will be cleaner than the above, with the drawback of adding another middle man. However if their shape is incompatible with that required by offline, it will be easier to tweak it into the expected format.