Time-controlled Azure WebJobs – Azure as easy as it get‘s

 

image2025-570x194

 

While still in development the Azure WebJob SDK offers some cool features for procession and supply of information. A good example is the sample that observes the Azure Queue and processes an item as soon as it spots one.

 

Scenario: time-controlled activities – without queue and so on

My scenario was quite simple. I was searching for a way to open a method time-controlled and store the data in the blob storage – without a cloud.

 

The code:

1: class Program 2: { 3: static void Main(string[] args) 4: { 5: JobHost host = new JobHost(); 6: host.Call(typeof(Program).GetMethod("WriteFile")); 7: } 8: 9: [NoAutomaticTrigger] 10: public static void WriteFile([Blob("container/foobar.txt")]TextWriter writer) 11: { 12: writer.WriteLine("Hello World..." + DateTime.UtcNow.ToShortDateString() + " - " + DateTime.UtcNow.ToShortTimeString()); 13: } 14: }

If you have a look on the most popular examples you might recognize that the method “RunAndBlock” won’t be started. That is also not necessary since the program will be “woken” by the scheduler to open the “write” method.

To get the code to work you have to deposit the following configurations. Afterwards you are able to zip the whole console application and upload it into the Azure portal and configure the scheduler.

Configurations:

1: <?xml version="1.0" encoding="utf-8" ?> 2: <configuration> 3: <connectionStrings> 4: <add name="AzureJobsDashboard" connectionString="DefaultEndpointsProtocol=https;AccountName=...;AccountKey=..."/> 5: <add name="AzureJobsStorage" connectionString="DefaultEndpointsProtocol=https;AccountName=...;AccountKey=..."/> 6: </connectionStrings> 7: <startup> 8: <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> 9: </startup> 10: </configuration>

 

After the upload:

The “WebJobs” are living inside the Azure Website. If you require a constantly running WebJob you have to make sure that the Azure website runs with “AlwaysOn=True”!

 

image

There is also a small administration portal for the WebJobs:

image

 

On the storage side a container will be created – including the container I’m using n the console.

 

image

And of course the data is also available:

image

 

Result

The first steps seem easy but at the same time quite clever. I like that so far.

The (not to complicated) code is from a developer of the WebJob team on Stackoverflow. Of course it is also available on GitHub.

Read more

HowTo: Create RSS Feeds with ASP.NET MVC

image2021-570x194_thumb.png

I’ve already written about how to consume RSS or Atom Feeds with the SyndicationFeed (in German, sry) but todays post is about how to create or publish an own feed. Beside the age of the feed standard and the much defamation from Facebook, Twitter and Google on RSS/Atom I consider this easy to consume API […]

Read more

How to access an Azure Website with the local IIS Manager

image1997-311x194_thumb.png

Since the end of February it is possible to access an Azure Website with the IIS Manager. Although the Azure Management site offers some information there are more details visible at the IIS Manager. For the connection you will need an IIS Manager and the IIS Manager for Remote Administration Extension. It’s also possible to […]

Read more

Create and validate own Json-Web-Tokens (JWTs)

image1929-570x143_thumb.png

If you are interested in web authentication you probably have heard about JSON Web tokens (JWT). What is a JWT? Maybe I’m not using the correct security termination but however: JWTs are used to exchange claims between two systems. For example: You want to log on to a service (like Facebook, Twitter, etc.) and want […]

Read more

Micro-Optimization: how to shrink or „embed“ pictures

  I’m currently working on the “CodeInside Dashboard” and since the page structure isn’t that difficult it should be possible to fulfill all of Google Pagespeed or Yahoos YSlow recommendations. One of the rules was to optimize the 4 PNGs that are embedded on the page.   Before – without optimization: Below you can see […]

Read more

Move to Windows Azure – VMs, Word Press Migration, DNS changes

image1979-570x194.png

Since mid January this blogs runs on a WordPress installation in an Azure VM. Because I always thought that the subject is quite complicated this blogpost offers a view behind the scenes. Why this move? So far this blog (both German and English Version) runs on a hoster somewhere in Germany. The main problem with this […]

Read more

Windows Azure Active Directory – CRUD for users and groups

  Windows Azure Active Directory? If you are not informed about the subject I recommend you to have a look on this Azure Info site. Which resources are there? The Azure AD contains the following entities: – Users – Groups – Contacts – Roles Access to the directory or on the “directory graph” Although the […]

Read more

Introduction into SignalR 2.0 & Azure Website Websockets

  SignalR is an Open Source Framework for Real Time WebApps. The main problem with Real-Time in the web is the canal between Browser and Server. If you never had to deal with SignalR and this problem before here is a brief introduction:   The problem Traditionally the browser initiates the request to the server […]

Read more

ESENT – the „ancient NoSQL DB“ made by Windows

  Those of you who use RavenDB might have heard about ESENT already. In the inside RavenDB uses the “Extensible Storage Engine” which is included into Windows since XP. Read here why Ayende is looking for an alternative for a while – although ESENT is basically reliable but that’s just a side note. ESENT is […]

Read more

Caller Information with .NET 4.5 or „Who touched the function?“

  Debugging and Logging Code are usually full of function names and so on just so you are able to find the right place in the code at the end. Of course there are several other reasons to find out who was the last one to open the code. The interface INotifyPropertyChanged is such an […]

Read more

Recent Posts

  • Time-controlled Azure WebJobs – Azure as easy as it get‘s

        While still in development the Azure WebJob SDK offers some cool features for procession and supply of information. A good example is the sample that observes the Azure Queue and processes an item as soon as it spots one.   Scenario: time-controlled activities – without queue and so on My scenario was quite […]

  • image2021-570x194_thumb.png
    HowTo: Create RSS Feeds with ASP.NET MVC

    I’ve already written about how to consume RSS or Atom Feeds with the SyndicationFeed (in German, sry) but todays post is about how to create or publish an own feed. Beside the age of the feed standard and the much defamation from Facebook, Twitter and Google on RSS/Atom I consider this easy to consume API […]

  • image1997-311x194_thumb.png
    How to access an Azure Website with the local IIS Manager

    Since the end of February it is possible to access an Azure Website with the IIS Manager. Although the Azure Management site offers some information there are more details visible at the IIS Manager. For the connection you will need an IIS Manager and the IIS Manager for Remote Administration Extension. It’s also possible to […]

  • image1929-570x143_thumb.png
    Create and validate own Json-Web-Tokens (JWTs)

    If you are interested in web authentication you probably have heard about JSON Web tokens (JWT). What is a JWT? Maybe I’m not using the correct security termination but however: JWTs are used to exchange claims between two systems. For example: You want to log on to a service (like Facebook, Twitter, etc.) and want […]

  • Micro-Optimization: how to shrink or „embed“ pictures

      I’m currently working on the “CodeInside Dashboard” and since the page structure isn’t that difficult it should be possible to fulfill all of Google Pagespeed or Yahoos YSlow recommendations. One of the rules was to optimize the 4 PNGs that are embedded on the page.   Before – without optimization: Below you can see […]

Support us