【问题标题】:How to deploy Azure Function App on Linux from Visual Studio如何从 Visual Studio 在 Linux 上部署 Azure Function App
【发布时间】:2019-10-08 17:55:39
【问题描述】:

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

当我从 Visual Studio 的发布对话框中选择“选择现有”时,我只能在连接的 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 的方法是什么?

【问题讨论】:

  • 发布时我也看不到 Visual Studio 上的 linux 应用程序。一定要用Visual Studio来部署吗?
  • 可以使用cmd
  • 我的解决方案解决了您的问题吗?
  • @BowmanZhu 谢谢你的建议!我会尽快尝试并报告。

标签: linux azure-functions publish


【解决方案1】:

1. 在 Visual Studio 中右键单击您的项目。选择“在文件资源管理器中打开 Floder”。

2.同时按win和R键,然后输入“cmd”,点击确定。

3.进入项目所在文件夹。

4.然后使用func azure functionapp publish &lt;APP_NAME&gt;(每个&lt;APP_NAME&gt;在Azure上都是唯一的。在我这边,它的名字是linuxFunctionAppBowman,你可以使用你之前创建的名字。)

5.函数已部署。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-05-27
  • 1970-01-01
  • 1970-01-01
  • 2020-08-06
  • 1970-01-01
相关资源
最近更新 更多