0

I have azure function application that runs a console application written in .NET Core 1.1 whenever there is a new item in service bus queue. The set up is working fine when I invoke manually in local host, but in hosted environment it seems not working as expected. The process is exiting quickly.

#r "Newtonsoft.Json"
using System;
using System.Threading.Tasks;
using Newtonsoft.Json;
using System.Diagnostics;

public static void Run(string myQueueItem, TraceWriter log)
{
    log.Info($"C# ServiceBus queue trigger function processed message: {myQueueItem}");

    dynamic queueMessage = JsonConvert.DeserializeObject(myQueueItem);

    string[] args = { 
            queueMessage.QueueId.Value.ToString(),
            queueMessage.TenantId.Value.ToString()           
    };

    log.Info(string.Join(" ",args));
    string publishExe = @"D:\home\site\wwwroot\QueueTrigger\app.exe";
    Process.Start(publishExe,string.Join(" ",args)).WaitForExit();
    log.Info("Process Exit");

}

Log from Azure Function App

   2017-10-13T14:43:54.293 Function started (Id=c80dfbb7-a06d-41e2-867e-1d526ee0bb70)

    2017-10-13T14:43:54.450 C# ServiceBus queue trigger function processed message: {"QueueId":22,"TenantId":71}

    2017-10-13T14:43:54.512 22 71 

    2017-10-13T14:43:55.075 Process Exit

2017-10-13T14:43:55.075 Function completed (Success, Id=c80dfbb7-a06d-41e2-867e-1d526ee0bb70, Duration=788ms)
tssutha
  • 99
  • 8
  • To isolate, try running the same exe from [Kudu Console](https://github.com/projectkudu/kudu/wiki/Kudu-console). – David Ebbo Oct 13 '17 at 15:01
  • Tried, but nothing happens, No errors in Powershell / Cmd, Seems like not starting the exe. – tssutha Oct 13 '17 at 15:29
  • 2
    Check the %errorlevel% after running it. It's probably failing. Also, try with an no-op app to help isolate if it's specific to yours – David Ebbo Oct 13 '17 at 15:38

0 Answers0