【Azure Function App】本地运行的Function发布到Azure上无法运行的错误分析
  ExOerB7z3frR 2023年12月26日 14 0

Starting Host (HostId=funapp-xxx-dev, Version=1.0.20776.0, InstanceId=xxx-x-xx-x-xxx, ProcessId=7924, AppDomainId=2, Debug=True, ConsecutiveErrors=0, StartupCount=1, FunctionsExtensionVersion=~1)

问题描述

Azure Function部署后未执行,查看日志发现错误信息:

2023-12-19T11:12:27.145 [Verbose] Host configuration applied.
2023-12-19T11:12:27.237 [Info] Starting Host (HostId=funapp-xxx-dev, Version=1.0.20776.0, InstanceId=xxx-x-xx-x-xxx, ProcessId=7924, AppDomainId=2, Debug=True, ConsecutiveErrors=0, StartupCount=1, FunctionsExtensionVersion=~1)
2023-12-19T11:12:27.102 [Verbose] Debug file watch initialized.
2023-12-19T11:12:27.222 [Verbose] File event source initialized.
2023-12-19T11:12:28.233 [Verbose] Function metadata read.
2023-12-19T11:12:28.345 [Verbose] Binding providers loaded.
2023-12-19T11:12:29.052 [Verbose] Binding providers initialized.
2023-12-19T11:12:29.052 [Info] Loaded custom extension 'BotFrameworkConfiguration'
2023-12-19T11:12:29.064 [Info] Loaded custom extension 'SendGridConfiguration'
2023-12-19T11:12:29.082 [Info] Loaded custom extension 'EventGridExtensionConfig'
2023-12-19T11:12:29.335 [Warning] Failed to load type 'xxxxx.xxxxx.xxxxx-1' from 'C:\home\site\wwwroot\bin\xxxxx.xxxxx.dll'
2023-12-19T11:12:29.335 [Warning] Failed to load type 'xxxxx.xxxxx.xxxxx-1' from 'C:\home\site\wwwroot\bin\xxxxx.xxxxx.dll'
2023-12-19T11:12:29.345 [Verbose] Extension loading complete.
2023-12-19T11:12:31.127 [Info] registered EventGrid Endpoint = https://funapp-export-dev.chinacloudsites.cn/admin/extensions/EventGridExtensionConfig
2023-12-19T11:12:31.847 [Verbose] Metadata provider created.
2023-12-19T11:12:32.407 [Verbose] Function descriptors read.
2023-12-19T11:12:32.407 [Info] Generating 0 job function(s)
2023-12-19T11:12:32.845 [Verbose] Development settings applied
2023-12-19T11:12:32.845 [Warning] No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).
2023-12-19T11:12:33.423 [Info] Host initialized (6699ms)
2023-12-19T11:12:33.486 [Info] Host started (6761ms)
2023-12-19T11:12:33.486 [Info] Job host started
2023-12-19T11:12:33.552 [Error] The following 2 functions are in error:
ExportJob: The function type name 'xxxxx.xxxxx.xxxxx-1' is invalid.
RemoveBlobJob: The function type name 'xxxxx.xxxxx.xxxxx-1' is invalid.
2023-12-19T11:12:33.708 [Info] Host lock lease acquired by instance ID 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'.

 

问题解决

在日志中,发现Function Host的Version=1.0, 这是非常老的Function Runtime Version。 而本地使用的 3.0 版本,所以从这一点判断出是版本问题导致。
需要通过设置 FUNCTIONS_EXTENSION_VERSION 参数,来指定版本信息。

 

 

参考资料

How to target Azure Functions runtime versions: https://learn.microsoft.com/en-us/azure/azure-functions/set-runtime-version?tabs=portal#automatic-and-manual-version-updates 

 

当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!



【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年12月26日 0

暂无评论

推荐阅读
  anLrwkgbyYZS   2023年12月30日   14   0   0 ideciciMaxideMax
ExOerB7z3frR