Azure 函数无法从 PowerShell 命令行部署

标签 azure azure-functions

我已经成功部署 PowerShell Azure 函数“MyApp-UT”一段时间了。我最近在 Azure 中创建了一个名为“MyApp-PROD”的新函数,但是当我将完全相同的代码部署到这个新函数时,出现以下错误。

func azure functionapp publish MyApp-PROD          
Getting site publishing info...
Creating archive for current directory...
Uploading 8.78 KB [###############################################################################]
Creating archive for current directory...
Uploading 8.78 KB [###############################################################################]
Creating archive for current directory...
Uploading 8.78 KB [###############################################################################]
Error uploading archive (InternalServerError).
Server Response: {"Message":"An error has occurred.","ExceptionMessage":"ChangeSetId(prod) does not match 7124f41ebe2c40278a6c3b6e96271a7b, 'master' or 'HEAD'","ExceptionType":"System.InvalidOperationException","StackTrace":"   at Kudu.Core.SourceControl.NullRepository.GetChangeSet(String id) in C:\\Kudu Files\\Private\\src\\master\\Kudu.Core\\SourceControl\\NullRepository.cs:line 73\r\n   at Kudu.Core.Deployment.FetchDeploymentManager.<PerformDeployment>d__9.MoveNext() in C:\\Kudu Files\\Private\\src\\master\\Kudu.Core\\Deployment\\FetchDeploymentManager.cs:line 235\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Kudu.Core.Deployment.FetchDeploymentManager.<>c__DisplayClass8_0.<<FetchDeploy>b__0>d.MoveNext() in C:\\Kudu Files\\Private\\src\\master\\Kudu.Core\\Deployment\\FetchDeploymentManager.cs:line 115\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Kudu.Contracts.Infrastructure.LockExtensions.<LockOperationAsync>d__7`1.MoveNext() in C:\\Kudu Files\\Private\\src\\master\\Kudu.Contracts\\Infrastructure\\LockExtensions.cs:line 134\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Kudu.Core.Deployment.FetchDeploymentManager.<FetchDeploy>d__8.MoveNext() in C:\\Kudu Files\\Private\\src\\master\\Kudu.Core\\Deployment\\FetchDeploymentManager.cs:line 108\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)\r\n   at Kudu.Services.Deployment.PushDeploymentController.<PushDeployAsync>d__12.MoveNext() in C:\\Kudu Files\\Private\\src\\master\\Kudu.Services\\Deployment\\PushDeploymentController.cs:line 429\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Kudu.Services.Deployment.PushDeploymentController.<ZipPushDeploy>d__8.MoveNext() in C:\\Kudu Files\\Private\\src\\master\\Kudu.Services\\Deployment\\PushDeploymentController.cs:line 97\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Threading.Tasks.TaskHelpersExtensions.<CastToObject>d__3`1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"}

但是切换回 MyApp-UT 我可以部署。

func azure functionapp publish MyApp-UT                                                                                                                                                                                                                                  
Getting site publishing info...
Creating archive for current directory...
Uploading 8.78 KB [###############################################################################]
Upload completed successfully.
Deployment completed successfully.

这两个函数之间应该没有什么不同。但它们属于不同的资源组。我对两者都有同等的访问权。关于如何开始解决此问题的想法?

最佳答案

发布答案是因为我花了 2 天多的时间才弄清楚。必须删除此 deployments 文件夹。但我不知道为什么......抱歉!

enter image description here

关于Azure 函数无法从 PowerShell 命令行部署,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67273083/

相关文章:

c# - 使用 Selenium WebDriver.dll 的 Azure 函数

azure - 使用共享程序集部署 Azure Function

azure - ASP.NET Core Azure WebJob 未记录到 Azure 存储

javascript - getmetadata 用于 Azure Blob 存储 NodeJ 中选择的 Blob

c# - 从Azure函数的路径获取html文件

azure - 在 Azure Function Startup.cs 中获取对 ILogger 的引用

c# - 针对 Windows Phone 8 开发并使用 Azure 的 Google 身份验证问题

c# - 通过 AzureServiceTokenProvider 对 CloudTableClient 进行 Azure 存储身份验证

azure - 如何终止特定的 Azure 辅助角色实例

asp.net - 每个用户多个 PDF 文件的 Azure DocumentDB 与 Blob 存储