How to set Azure WebJob queue name at runtime?

This can now be done. Simply create an INameResolver to allow you to resolve any string surrounded in % (percent) signs. For example, if this is your function with a queue name specified: public static void WriteLog([QueueTrigger(“%logqueue%”)] string logMessage) { Console.WriteLine(logMessage); } Notice how there are % (percent) signs around the string logqueue. This means … Read more

Dependency injection using Azure WebJobs SDK?

Azure WebJobs SDK now supports instance methods. Combining this with a custom IJobActivator allows you to use DI. First, create the custom IJobActivator that can resolve a job type using your favourite DI container: public class MyActivator : IJobActivator { private readonly IUnityContainer _container; public MyActivator(IUnityContainer container) { _container = container; } public T CreateInstance<T>() … Read more

How should I perform a long-running task in ASP.NET 4?

Preferentially, avoid having long tasks executing in such an environment. Delegate long running tasks out to a stable system service via interoperability, leaving the web application responsive and only required for direct user requests. Web applications have never been (and still aren’t) considered reliable systems – anyone who has ever used a browser has encountered … Read more