Azure Function v2 Web Deploy 遇到服务器连接问题,不得不终止连接

Azure Function v2 Web Deploy experienced a connection problem with the server and had to terminate the connection

尝试从 Visual Studio 发布 V2 函数时出现发布错误:

Publish has encountered an error. Publishing failed.

来自输出 windows 的消息是:

Web deployment task failed. (Web Deploy experienced a connection problem with the server and had to terminate the connection. Contact your server administrator if the problem persists. Web Deploy experienced a connection problem with the server and had to terminate the connection. Contact your server administrator if the problem persists. Unexpected end of file has occurred. The following elements are not closed: results. Line 1, position 550.

诊断日志的内容是:

06/05/2019 11:32:37 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.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.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.d__183.MoveNext() ---> (Inner Exception #0) System.Exception: Publishing failed.<---

我创建了一个新的 HTTP 函数,在本地对其进行了测试并尝试发布它。

有人知道如何解决这个问题吗?

通过快速入门指南(再次)找到了此问题的修复方法:

Publish the Project to Azure

您需要 select "Run from package file (recommended)" 的选项。