Can I use server side code in Windows Azure Mobile Services - azure

I have noticed when accessing windows mobile service I can schedule tasks to perform at certain times. I also noticed that the script to perform these tasks is only javascript? Is there a way I can use some server side code to perform a mobile service?
I want to be able to connect to an API. Check for a specific update. If that update is present send an email to myself.
Unfortunately this API suffers from the same-origin policy and doesn't offer a solution like JSONP. Therefore I will need to handle this API access server side.

Currently you can only use JavaScript, but support for other languages (like C#) is planned.

I was interested in Widows Azure Mobile Services because of the Scheduler service, as a simpler alternative to jobs running in Worker Roles with Quartz and other alternatives, but I felt the same difficulty you describe in having to work in a JS only environment, which is a problem in my scenario.
Are you aware of Windows Azure Web Site Web Jobs (here and here)? You can configure continuous or scheduled jobs developed in many script languages as well as in .Net.
We moved many smaller tasks from under-utilized and more complex Worker Roles to Web Jobs as simple .Net console apps. Via the Web Jobs SDK you also get a good monitoring environment.

Related

How to deploy windows service on Azure App Service

I have developed a windows service. i need to deploy it in Azure App Service. Please someone explain me how to do that. Is there any way to install it on console or any other option.
You can't deploy a Windows Service using App Service. One option is to convert your code into a Web Job. Another option is to use a Virtual Machine instead of App Service.
Azure App Service is the service that should be used for Web/Mobile and basically is the web-server-as-a-service. You have almost no access to the underlying system, and system-wide actions like a working windows service is likely impossible.
I see three ways:
1) Migrate to Worker Role, but it is classic model. There is a good article on how to do that, i took a look and did not see any potential problems. It is more simple way.
2) Migrate your windows service to Web Job and run it as a background service. It will need you to rewrite some parts of your service, i think - but there are supported executable formats out-of-the-box. Take a look at how it works.
3) Take a look at Azure Functions - it is "trigger-and-invoke" service that can be used for listening for events and executing actions.
But, if you need to catch some events from DB, then i am not sure that it will be possible with that, because Web Job is more like a service that listens for external events, and yours scenario looks like you want to catch events from the same server. That way, i would recommend you to place it on a virtual machine to avoid the rewriting or migrating time-consuming issues.

Create Azure task scheduler

We are going to host our ASP.Net web site on Azure server. I am not quite familiar with Azure. I need to create some kind of scheduler which will send request to google API once a week and save response data to DB. I read some articles about Worker Role. Is it suitable for this? How it should be deployed to the Azure server? Any other solutions?
You could certainly make use of Worker Role for that purpose however I would not recommend going down that route as you are only going to use the functionality once a week. Or in other words you would be under utilizing the resources. Do take a look at Windows Azure Mobile Service Scheduler: http://www.windowsazure.com/en-us/develop/mobile/tutorials/schedule-backend-tasks/. Other alternative would be use a 3rd party service like Aditi Scheduler: http://www.aditicloud.com/. There's also a website which also allows you to do the same functionality (I'm sorry I forgot the name of that site :)).
If you're still keen on doing it through Windows Azure Worker Role, I wrote a blog post about the same which you may find useful: http://gauravmantri.com/2013/01/23/building-a-simple-task-scheduler-in-windows-azure/.

owin Self-hosting web api new relic monitoring

I just moved some of are web api from IIS web role to a worker role in Windows Azure and that is working way betting. What I want to know is how much better so, and before we using New Relic to monitor the web server. I have the agent installed on the worker roles but not getting any of the great analytics.
(What I followed to make this work)
So I was hoping someone could help me get some basic stats on how well my self-hosted web server is performing into new relic. I looking for throughput, response time, and log errors.
I found something that seems to make me think that I could do it but I am not familiar with owin.
If anyone has some ideas on how to get this work that would great!
Edit:
What I am looking for is if someone can help me use the newrelic api ( RecordMetric(), RecordResponseTimeMetric(), IncrementCounter(), etc.) and hook it up in the owin pipeline to record throughput, response time, and log errors?
The New Relic .NET agent gathers most transaction-related metrics within the context of the IIS pipeline. The agent can get some basic metrics for standalone services like Worker Roles (WaWorkerHost.exe). Without any special setup, you can monitor calls per minute, RAM/CPU utilization, database calls and external requests. Beyond this, you'll want to use the .NET agent API:
https://newrelic.com/docs/dotnet/the-net-agent-api
Namely RecordMetric(), RecordResponseTimeMetric() and IncrementCounter() are available for Azure Worker Roles and other non-IIS applications. Other methods in the API require proper HttpContext instances.

How to most efficient launch Node.js app on Windows Azure?

Exist three ways for deploy Node.js app on Windows Azure, web-role, web-site and git-azure (link). I don't know whitch is most efficient for my needs. My app is readability algorithm with RESTful API, whitch parse news sites, simple computing, but highload. Of course, I need transparent horizontal scaling. I hope for your help.
My $0.02.
If your product is only based on Node.js, without many layers and components such as background workers, business logic layer and API layer, Windows Azure Web Site should be the best choice. It's very simple to deploy Node.js application through Git, GitHub, TFS, FTP, etc. It also provides scaling-up (in reserve mode) and scaling-out options. But keep in mind that all applications under Windows Azure Web Site will be running in 32bit WOW mode.
Windows Azure Web Role is similar as Windows Azure Web Site, but you need configure the Node.js environment by yourself. (If you are using the azure powershell tool, it can help you establish the node stuff by using some startup commands.) If you need something working in worker roles, or the caching (not the shared caching), Web Role may be better.
I've never heard about the git-azure but it looks like a tooling that you can host more than one node application on worker role.

What types of projects are suitable for Azure?

What type of projects/software applications are suitable for Azure and why?
Thanks
Rather than thinking of what can be supported in Azure, it might be more helpful to think about its challenges as you decide to port your app over:
Web applications. Since a Web Role hosts IIS, you'll generally have little issue porting a general-purpose asp.net or asp.net mvc website to Azure. There are some glitches you'll run into - see my related answer for more details.
UI. If your app has specific output similar to a WinForms app, you won't be able to run it since you have no video output.
GPU dependencies. If you're doing some background processing dependenton a specific GPU, you won't be able to run in an Azure VM.
Registry and other system-level access. If your app needs to update the registry or run an MSI, you won't be able to install your app.
Instance affinity. If your app requires session stickiness (e.g. a logged-in user MUST visit the same server instance with each access), you won't be able to accomplish this.
COM interop. COM interop is very limited, since you can't install anything via the registry. If you rely on Excel Services, you won't have that capability.
SQL limitations. SQL Azure is limited to 50GB today, and offers no ability to custom-tune the server instance. Also, while it does support a big subset of SQL Server, it doesn't support 100% of SQL Server, so it's possible some of your sprocs may no longer work. There's no SQL Agent today, so you'd need to recreate that functionality in a worker process.
That's just a quick braindump of some challenges you might run into - I'm sure there are others.
Just keep in mind that Azure is providing Windows 2008 Server images for your app to run on, so if your app can run in that environment today, and doesn't require things I listed, you should be in pretty good shape.
You can make most of the .NET projects working in Azure. Azure has support of following project types: web site (both ASP.NET and ASP.NET MVC), worker (background application) and wcf service.
Don't forget security too - there's various ways of authenticating onto Azure but none are as simple as just setting IIS/ASP to windows auth.

Resources