Search code examples
azureazure-batch

Task failure and Exit code -532462766 in Azure Batch


I am trying to run a Console Application in Azure Batch. I have created the Client Application having responsibility of creating and running Job & Tasks in the Azure Batch so far. My ClientApplication successfully creates a Job, a Task within the Job but when the application code uploaded on the AzureStorage get executed in Azure the Pool, the Task fails and exits with an Exit code -532462766. I could not find any information for this exit code. Please help me to fix this.

Here is my code for creating the task and it's configuration

    private static async Task<List<CloudTask>> AddTasksAsync(BatchClient batchClient, string jobId)
    {
        Console.WriteLine("Adding {0} tasks to job [{1}]...", 1, jobId);

        List<CloudTask> tasks = new List<CloudTask>();

        string taskId = "topNtask";
        string taskCommandLine = String.Format("cmd /c %AZ_BATCH_NODE_SHARED_DIR%\\SelfHostedWebAPI.exe {0} {1} {2}", 11109, "MSS_F_MST_______", "Normal");
        //string taskCommandLine = String.Format("cmd /c %AZ_BATCH_NODE_SHARED_DIR%\\SelfHostedWebAPI.exe");

        CloudTask task = new CloudTask(taskId, taskCommandLine);
        tasks.Add(task);

        await batchClient.JobOperations.AddTaskAsync(jobId, tasks);

        return tasks;
    }

And the task failure report from my Azure Portal

enter image description here


Solution

  • Finally I got the solution of this problem and to save one's precious time here is the solution. We need to upload each and every .dll files and dependencies of our code that run in Azure Pool to the linked AzureStorage account. In addition, when the pool is being created and it's StartTask is initialized, a ResourceFile with SAS(Shared Access Signature, for the target .dll that it points) for every .dll file or any other type, should be given to it as a parameter.