Azure WebJob 部署问题

Azure WebJob deployment issue

我有一个基本的 Azure WebJob,当我运行通过 VS 时 运行s 并打印所需的输出如下

但是当我从门户部署和 运行 时,出现以下错误。

[07/15/2020 07:23:03 > 8f28d2: SYS INFO] Status changed to Initializing
[07/15/2020 07:23:03 > 8f28d2: SYS INFO] Job directory change detected: Job file 'RedmineSyncUp.exe' timestamp differs between source and working directories.
[07/15/2020 07:23:15 > 8f28d2: SYS INFO] Run script 'RedmineSyncUp.exe' with script host - 'WindowsScriptHost'
[07/15/2020 07:23:15 > 8f28d2: SYS INFO] Status changed to Running
[07/15/2020 07:23:16 > 8f28d2: SYS INFO] Status changed to Failed
[07/15/2020 07:23:16 > 8f28d2: SYS ERR ] Job failed due to exit code -2146232576

我正在通过 VS 进行部署。

这是我的代码。

Function.cs

public class Functions
    {
        // This function will get triggered/executed when a new message is written 
        // on an Azure Queue called queue.
        public static void ManualTrigger([Table("log")] CloudTable logTable)
        {
            for (int i = 0; i < 5; i++)
            {
                DateTime dt = DateTime.Now;

                Console.WriteLine(dt.ToString());
            }
          
        }
    }

Program.cs

static void Main()
        {
            try
            {
                JobHost host = new JobHost();
                Task callTask = host.CallAsync(typeof(Functions).GetMethod("ManualTrigger"));

                Console.WriteLine("Waiting for async operation...");
                callTask.Wait();
                Console.WriteLine("Task completed: " + callTask.Status);

                host.RunAndBlock();
            }
            catch (Exception ex)
            { Console.WriteLine(ex.Message); }
           
        }

如果我使用已发布的包进行部署,结果也是一样的。

看起来这个错误与 WebJobs 的目标 .Net 框架有关。

能否请您看看您的目标是哪个 .Net 框架?能不能把webjob的target framework改成4.7看看能不能用?