Connecting Azure Mobile Services to UWP - c#

I have created a Mobile service in Azure, and connected an SQL database in it.
I installed the required Nuget Package Microsoft.Azure.Mobile.Client, and i tried Microsoft.WindowsAzure.MobileServices , and inserted this code in my App.xaml.cs:
public static MobileServiceClient MobileService = new MobileServiceClient("https://sqlbackend.azurewebsites.net");
The Problem is: When i come to connect an azure mobile service to the project, they say it is not supported.
Is there any way to connect my project to an azure mobile service?

What kind of project the client is?
If it's Azure Mobile Service or Azure Mobile App itself, no need to add a connected service, just right-click the project,select Publish,import the web app publish settings file and publish to Azure.
If it's Windows Phone WebView App or others supported by tooling gesture, the configure button will be enabled and the code in App.xaml.cs should be:
public static MobileServiceClient MobileService = new MobileServiceClient
("https://sqlbackend.azurewebsites.net", "XXXX-APPLICATION-KEY-XXXXX");
The second parameter is application key which is generated here:
PS: The code above and adding connected service(Azure Mobile Service) reach the same result and no need to use both at the same time.

You are using the old Azure Mobile Services client.
Links for you:
HOWTO:
https://azure.microsoft.com/en-us/documentation/articles/app-service-mobile-dotnet-how-to-use-client-library/
SDK Docs:
https://msdn.microsoft.com/en-us/library/azure/mt419521(v=azure.10).aspx
When you convert to using Microsoft.WindowsAzure.MobileServices, it will inject the right header and you will not get the Unsupported message.
After reviewing your question again, you need to match up the type in the server with the type in the client. If you have created an Azure Mobile Service, then your client should be Microsoft.Azure.Mobile.Client. If you have created an Azure App Service Mobile App, then your client should be Microsoft.WindowsAzure.Mobile.Client - the links I provided were for Azure Mobile Apps (not Services in the client). I recommend Azure Mobile Apps (which can be considered the latest generation of such). Tutorials are available on azure.com

Related

How to deploy to azure signalr service from visual studio or via command line

I have been trying to find some guide or article on how to deploy code on azure signalr service. Currently I am using azure app service for signalr which is temporary alternative for development only. I cant see signalr service instances (that I have created from azure portal) during publish in visual studio.
Any help or pointers would be much appreciated.
Posting answer as suggested.
I have figured out the answer to this, if we enable some configuration in signalr app like userAzureSignalr it deploys the code to the signalr service instance within the same resourse group otherwise you can specify connection string of the signalr service instance where you want this to run. As per my understanding you need at least one app service instance to deploy your code and the hub related code will run on signalr service instance and you would be able to see the traffic in signalr service.

Azure Push notifications without Azure Mobile project?

I'm building a Phonegap application that uses a server backend built with .net MVC 5 & Web API2. It's hosted on Azure cloud services and all is working well.
I now need to add some functionality to send push notifications when certain events happen. I've set up a Mobile Service on Azure and configured it for IOS (I will add Android when I have it working) and I now need to start coding the functionality.
I was planning on storing the device registration Id in my own Database and writing a simple class/service that consumes the Azure Mobile Services API to send the push notification. I've spent the last few hours reading up on this and all of the tutorials involve creating a new Azure Mobile Services project which uses Azure Table storage and configuring that (https://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn629482.aspx).
I'd like to avoid this as it seems like overkill and it's yet another thing I'll need to deploy and manage.
Does anyone know if it is it possible to just add the required references to my existing cloud services project and do it the way I proposed?
Many thanks,
John
Since you already have a working backend, you don't need a Mobile Service just to send Push Notifications. Take a look at Azure Notification Hubs. You can call it via REST from your MVC, or use the Azure Service Bus NuGet package.
Take a look at this introduction: Get started with Notification Hubs
Note that you will need two different Notification Hubs, one with the sandbox APNs certificate for use with Xcode development builds, and one with the production APNs certificate for release and ad-hoc builds. If you don't have a separate instance of your MVC service for development, you will have to keep the device registrations straight somehow between the two.

Windows 8 And Windows Phone Push Notifications Using Azure

I've looked into Azure Mobile Services and found its great but does not give me the flexibility I want (Node.js also leaves a bad taste in my mouth coming from C#).
I was using periodic update notifications in Windows 8 and already have an ASP.NET Web API project supplying tile images and tile xml content. I was hoping to use an Azure Worker Role with Azure storage tables for Push Notifications for Windows 8 and Windows Phone.
I found this example but it seems to be for VS2012 Release Preview. I can't find an updated version or any other samples to work with. In particular I want my service to support both Windows 8 and Windows Phone.
http://watwindows8.codeplex.com/wikipage?title=Push%20Notification%20Worker%20Sample
If anyone can outline the references/nuget packages I need. It would be a great help.
EDIT:
Jim O'Neil's blog is a good starting point. I need to use a Azure Worker Role because I want to send my notifications periodically.
I also found the WnsRecipe NuGet package for sending push notifications from the server. Jim O'Neil solution is just as good.
Finally, to save a bit of time, I was hoping to avoid writing data acess code for registering apps channel ID's to a table on the server. The Azure Mobile Services MobileServiceClient class is a great solution to this as it lets you do all of this with a couple of lines of code. The table is available through REST services. However, questions remain:
Can I continue using the Mobile Services Table Storage MobileServiceClient with my app and Azure Worker Role or do I have to use Azure Table Storage?
If I can use MobileServiceClient, how do I access the table from my Azure Worker Role?
If I have to use Azure Table Storage which also provides a REST service for free, how can I access the table from my Windows 8 app?
Windows Azure Service Bus just released a new feature that allows to push Windows 8 (and iOS) notifications from C# back-ends (and soon from Mobile Services too), with no need top handle ChannelURIs at all.
Take a look at: http://channel9.msdn.com/Shows/Cloud+Cover/Episode-100-Introduction-to-the-Windows-Azure-Service-Bus-Notification-Hubs
Windows 8 code walkthrough: http://channel9.msdn.com/Blogs/Subscribe/Service-Bus-Notification-Hubs-Code-Walkthrough-Windows-8-Edition
If you try it, let me know what you think!
Strictly speaking, no NuGet packages are needed, they are just wrappers for functionality (it's all REST/OAuth under the covers) to make your life easier. As you observed, the Windows Azure Toolkit for Windows 8 and Windows Phone has been somewhat supplanted by Windows Azure Mobile Services.
If you want to do it all yourself, you can check out a three part blog series I did on using Azure Web Sites for Push Notifications. It's Web Sites, not Web Roles, but that part is fairly interchangeable; although, I'd say that Web Sites are going to be a far more economical option here unless you already have a service implemented that you are using.
I don't have Windows Phone incorporated into that series, and Windows Phone does use a slightly different notification mechanism from Windows 8, but that's on my to-do list, and hopefully what is there will get you going in the right direction.
When you use the MobileServiceClient to store data in Mobile Services, you are actually storing your data in a SQL Azure database. You have a number of options when it comes to accessing this data from your worker role.
Connect directly using a SQL client. This could be Entity Framework, a different ORM, or even raw ADO.NET. You can get the connection string for your database by selecting it in the Azure portal. On the dashboard tab there is an option to show connection strings.
Use a client library to access the data via Mobile Services. Unfortunately we do not have an official SDK that can be used from a worker role yet but the good news is that there is an unofficial package on NuGet
Access the data directly via the HTTP endpoint that Mobile Services provides by making HTTP requests. The API is documented here.

Porting existing console application to Windows Azure

I have some console applications that communicate using WCF over TCP. Is it possible/easy to port a console application to Windows Azure, or must the application be hosted in IIS/asp .net?
Since you do not really log into a Windows Azure machine and see the screen as you could do with a local server in your network I guess you should only develop server side components or IIS Hosted services and web applications exactly as you said.
you could get the Windows Azure SDK: Windows Azure SDK and explorer the available templates and alternatives locally in your machine.
A console application can be started from a role - web or worker - and communication to that app can be via the InputEndpoint (HTTP, HTTPS or TCP).
I worked on a project that spawned a console app from a worker role, the role fed workloads read from storage queues direct to a WCF service hosted in the console application - using tcp.
I found that you can use startup tasks in the config file for Azure. That works.

System.Speech on Windows Azure Error

I am trying to call some methods from System.Speech via a WCF Service hosted on Windows Azure. When i try this locally on the development fabric, it is working perfectly fine. I can consume the methods from this Speech API via WCF service in my client.
But when I up this service in real cloud on Azure, i get the following exception error message on the client:
No voice installed on the system or none available with the current security setting.
I have tried to set Copy Local property to True of System.Speech dlls but it is still throwing this exception to me.
Is there any workaround for this?
It looks like Windows Azure does not have actual voice engines installed. Unless it is possible to easily deploy them via the XCopy (which I doubt), then at the moment there is no way to use Speech on Windows Azure.

Categories