7

I have a legacy exe which takes local machine file path, processes it and produces output file in again the local path. Can this be run on Azure Webjob?

I was thinking to write a wrapper exe which downloads file from blob storage -> store it in local file system -> call the legacy exe with local file path -> get the output and upload it to the blob again.

Will this approach work or there are limitations?

user3863695
  • 123
  • 1
  • 6
  • I realize this post is old now, but did you ever end up finding a solution? I have to same issue of trying to access local file pathes via a webjob. – Connor Williams Nov 15 '17 at 13:45

2 Answers2

6

If you end up writing a wrapper, then the Files binding extension for the WebJobs SDK might be of interest to you: https://github.com/Azure/azure-webjobs-sdk-extensions. For example:

    // When new files arrive in the "import" directory, they
    // are uploaded to a blob container then deleted.
    public static void ImportFile(
        [FileTrigger(@"import\{name}", "*.dat", autoDelete: true)] Stream file,
        [Blob(@"processed/{name}")] CloudBlockBlob output,
        string name,
        TextWriter log)
    {
        output.UploadFromStream(file);
        file.Close();

        log.WriteLine(string.Format("Processed input file '{0}'!", name));
    }
mathewc
  • 13,312
  • 2
  • 45
  • 53
3

Such exe should run fine, as long as you get to pass it the folders to write from/to. Before getting into WebJobs, I suggest testing it manually in a Web App using Kudu Console, to make sure it runs fine.

Then if your goal is to have it work with blob input/output, the wrapper exe should work. Obviously, it'd be cleaner to have it directly work with blog streams, but if the legacy exe is a given and can't be changed, the wrapper approach should be fine.

David Ebbo
  • 42,443
  • 8
  • 103
  • 117
  • Thanks David. I will try Kudu Console – user3863695 Oct 05 '15 at 16:24
  • I tried in the Kudu console here is the finding: The legacy exe has some dependency on Windows SDKs like (Windows 8.1 SDK and Phone SDK), so it is failing to run. Will it be possible to have this legacy exe still run on Azure WebJob? – user3863695 Oct 08 '15 at 18:22
  • 1
    It will only be able to run if you find a way to bring the relevant dependencies with it (not always possible if it's low level system things). Ig there is no way to make it work via Kudu Console, then it will not work either via WebJobs, as it all runs in the very same environment. – David Ebbo Oct 08 '15 at 23:42