如何从 Visual Studio 在 Linux 上部署 Azure Function App

How to deploy Azure Function App on Linux from Visual Studio

如何从 Visual Studio 2019 年将 Azure Function App V2 部署到 Azure 中现有的 Linux Function App 计划?

当我从 Visual Studio 中的发布对话框 select "Select existing" 时,我只能在连接的 Azure 订阅中看到基于 windows 的函数,但是 Linux 我在同一订阅中创建的一个丢失了。

当我下载函数应用程序的发布配置文件、导入它并尝试以这种方式发布时,我收到一个错误,恕我直言,这不是很有用:

System.AggregateException: One or more errors occurred. ---> System.Exception: Publishing failed.
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Microsoft.Publish.Framework.Model.DefaultPublishSteps.<>c__DisplayClass26_0.<IsBuildCompletedSuccessfully>b__2()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Publish.Framework.Model.DefaultPublishSteps.<DefaultCorePublishStep>d__23.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Publish.Framework.ViewModel.ProfileSelectorViewModel.<RunPublishTaskAsync>d__202.MoveNext()
---> (Inner Exception #0) System.Exception: Publishing failed.<---

System.Exception: Publishing failed.

将 C# Azure Functions 发布到 Linux 上的 Azure Functions 运行 的方法是什么?

1.right 在 Visual Studio 中单击您的项目。 Select 'Open Floder in File Explorer'.

2.Press 同时按 win 和 R 键,然后输入 "cmd" 并单击确定。

3.Go到项目所在文件夹

4.Then 使用 func azure functionapp publish <APP_NAME>.(每个 <APP_NAME> 在 Azure 上都是唯一的。在我这边,它的名字是 linuxFunctionAppBowman,你可以使用您之前创建的名称。)

5.Function 已部署。