如何 troubleshoot/fix Azure Function 主机崩溃?

How to troubleshoot/fix Azure Function host crashing?

Azure 门户显示我的 azure 功能已启动并且 运行,但是当我通过浏览器导航到 https://{functionapp-name}.azurewebsites.net 时,我得到

"Function host is not running."

但我确实可以通过观察

看到处理有时会发生

{functionapp-name}/LogFiles/Application/Functions/Host/*.log file.

有什么解决此问题的建议吗?

重启Function app后检查Function host is not running是否一致。并确保我们检查了最新的日志。

基本上,如果我们的功能主机无法启动,我们可以在主机日志中查看详细信息,除非修复错误,否则功能将不会处理。

对于成功启动的功能主机,我们可以看到类似

的日志
Host initialized
Host started
Job host started
Host lock lease acquired by instance ID 'xx'.

如果我们得到的只是那些没有错误的令人愉快的信息,并且功能按预期触发,就没有什么可担心的。

一旦出现一些错误(例如在host.json and proxies.json设置中)停止主机启动,错误如下所示。按照官方样本尝试修复即可。

A host error has occurred
xxx //some error details
Stopping JobHost
Job host stopped