在同一个功能应用程序中发布另一个功能后,Azure功能失败,但再次发布时效果很好

时间:2019-09-10 13:37:59

标签: azure-functions

我在功能应用程序中有一个天蓝色的功能Function1。在运行时执行得很好。

我在同一个功能应用程序中有另一个天蓝色功能Function2。

每当我发布Function2时,Function1都会开始失败,并显示以下错误消息:

2019-09-10T13:07:42  Welcome, you are now connected to log-streaming service. The default timeout is 2 hours. Change the timeout with the App Setting SCM_LOGSTREAM_TIMEOUT (in seconds). 
2019-09-10T13:08:26.994 [Info] Function started (Id=57101022-3a64-4a00-b67a-ff7628f0e2a8)
2019-09-10T13:08:27.510 [Error] Function completed (Failure, Id=57101022-3a64-4a00-b67a-ff7628f0e2a8, Duration=519ms)
2019-09-10T13:08:27.666 [Info] Function started (Id=550ac91a-63fb-4901-bac5-54c65d24807b)
2019-09-10T13:08:27.697 [Error] Function completed (Failure, Id=550ac91a-63fb-4901-bac5-54c65d24807b, Duration=22ms)
2019-09-10T13:08:27.775 [Info] Function started (Id=9af54597-3f1f-433b-aa5b-2ca5d7551d67)
2019-09-10T13:08:27.838 [Error] Function completed (Failure, Id=9af54597-3f1f-433b-aa5b-2ca5d7551d67, Duration=60ms)
2019-09-10T13:08:27.885 [Info] Function started (Id=c6439dbb-e4b1-4d43-8bd6-f088af00c10d)
2019-09-10T13:08:27.916 [Error] Function completed (Failure, Id=c6439dbb-e4b1-4d43-8bd6-f088af00c10d, Duration=28ms)
2019-09-10T13:08:27.978 [Info] Function started (Id=607081f0-4156-42de-9df3-281b2dac08ae)
2019-09-10T13:08:28.025 [Error] Function completed (Failure, Id=607081f0-4156-42de-9df3-281b2dac08ae, Duration=42ms)
2019-09-10T13:08:28.072 [Info] Function started (Id=8087f651-a85f-4496-8373-665d5777052b)
2019-09-10T13:08:28.135 [Error] Function completed (Failure, Id=8087f651-a85f-4496-8373-665d5777052b, Duration=50ms)
2019-09-10T13:08:28.181 [Info] Function started (Id=92ce5540-ea45-4c18-8189-ba90659b5c09)
2019-09-10T13:08:28.213 [Error] Function completed (Failure, Id=92ce5540-ea45-4c18-8189-ba90659b5c09, Duration=39ms)
2019-09-10T13:08:28.260 [Info] Function started (Id=2a344ba3-dd5f-49b2-ab06-60d0667d12cb)
2019-09-10T13:08:28.322 [Error] Function completed (Failure, Id=2a344ba3-dd5f-49b2-ab06-60d0667d12cb, Duration=46ms)
2019-09-10T13:08:28.369 [Info] Function started (Id=f48005e9-2220-48a1-bab3-032a5f99b6fe)
2019-09-10T13:08:28.400 [Error] Function completed (Failure, Id=f48005e9-2220-48a1-bab3-032a5f99b6fe, Duration=31ms)
2019-09-10T13:08:28.447 [Info] Function started (Id=6b494d51-49c5-4701-a4d4-5b4b1e6f2b65)
2019-09-10T13:08:28.478 [Error] Function completed (Failure, Id=6b494d51-49c5-4701-a4d4-5b4b1e6f2b65, Duration=32ms)

我们在上面的错误消息中看到,它只有

的日志
[Info] Function started (Id=57101022-3a64-4a00-b67a-ff7628f0e2a8)

[Error] Function completed (Failure, Id=57101022-3a64-4a00-b67a-ff7628f0e2a8, Duration=519ms)

并且执行甚至不在函数内部。

我有解决此问题的方法。那就是重新发布Function1,错误消失并且Functions执行正常。

如何避免每次发布Function2时都需要重新发布Function1来避免上述错误?

谢谢

1 个答案:

答案 0 :(得分:1)

值得说明的是,对于功能而言,部署单位是整个应用程序。您不仅要发布或更新单个功能,还要发布整个应用程序。

就可能引起问题的原因而言,我并不满意。看的地方之一就是您的发布方式。去年,我们引入了run from package,使您可以发布单个zip工件。如果您未启用此选项,则有可能在function1仍在尝试执行时复制了一些文件,并且它们最终处于错误状态。如果是这种情况,启用从程序包运行应该可以解决您的问题(应该是Visual Studio发布中的复选框,或者是VS Code中的默认选项)。