最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - Azure function apps configuration - Stack Overflow

programmeradmin2浏览0评论

I am currently working on Azure Function Apps in a .NET 8 isolated environment. In this project, we are trying something new that I have never heard of before. Specifically, I am creating multiple Azure Function projects within a single solution. I successfully set this up, and it worked locally. However, after deploying to Azure, I encountered some errors.

One major issue is that the Timer Triggers I added are not appearing in the Function tab, where triggers are usually displayed. When I checked for errors, I found the following message:

No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g., Azure Storage, ServiceBus, Timers, etc.), make sure you've called the registration method for the extension(s) in your startup code (e.g., builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).

Regarding my deployment structure, inside the wwwroot folder, there are two subfolders, each containing its respective DLLs and host.json files. I modified my YAML configuration to copy host.json out of the subfolders so that it exists at the root level, alongside the two folders. However, host.json is still present inside each subfolder, meaning there are now three host.json files in total.

I have verified that my trigger functions are correctly implemented, but the issue persists. I am unsure how to proceed. Does anyone have experience with this or any guidance on resolving it?

I am currently working on Azure Function Apps in a .NET 8 isolated environment. In this project, we are trying something new that I have never heard of before. Specifically, I am creating multiple Azure Function projects within a single solution. I successfully set this up, and it worked locally. However, after deploying to Azure, I encountered some errors.

One major issue is that the Timer Triggers I added are not appearing in the Function tab, where triggers are usually displayed. When I checked for errors, I found the following message:

No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g., Azure Storage, ServiceBus, Timers, etc.), make sure you've called the registration method for the extension(s) in your startup code (e.g., builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).

Regarding my deployment structure, inside the wwwroot folder, there are two subfolders, each containing its respective DLLs and host.json files. I modified my YAML configuration to copy host.json out of the subfolders so that it exists at the root level, alongside the two folders. However, host.json is still present inside each subfolder, meaning there are now three host.json files in total.

I have verified that my trigger functions are correctly implemented, but the issue persists. I am unsure how to proceed. Does anyone have experience with this or any guidance on resolving it?

Share Improve this question edited Mar 20 at 9:32 Tiny Wang 16.5k2 gold badges18 silver badges38 bronze badges asked Mar 20 at 8:04 KarthikKarthik 11 bronze badge 15
  • 1 That's close to impossible to analyze without seeing any of what you have. And I am aware that that in itself is a little hard to do, here. So, what I would suggest is to setup a new Solution with one single Function. Deploy, verify it deploys and runs as expected. Add another one, rinse, repeat until it fails. Then fix that. Then pick up where you were interrupted by the failure. – Fildor Commented Mar 20 at 8:10
  • Do you mean, you have several .Net 8 isolated work model function projects in one solution, and you publish the solution to one Azure function instance and hope this Azure function instance could host all functions contained in the projects? – Tiny Wang Commented Mar 20 at 9:43
  • 1 Yes, I have multiple .NET 8 isolated function projects in one solution, and I’m trying to deploy them into a single Azure Function App(Single app service). – Karthik Commented Mar 20 at 10:06
  • 1 I probably have multiple executables, and I am grouping them by applications. Based on these groups, I am trying to create separate Azure Function Apps within a single solution and deploy them to a single App Service. – Karthik Commented Mar 20 at 10:11
  • 1 @TinyWang, you’re right. We also tried that as an experiment to see if we could achieve a new way of structuring the project. However, we failed multiple times and searched for references, but unfortunately, we couldn’t find much hope. That’s why I posted here. We gave it our best shot, but it didn’t work out, so we eventually switched back to the traditional approach and successfully completed the work. Thank you, everyone, for helping me explore new possibilities! – Karthik Commented Mar 25 at 10:10
 |  Show 10 more comments

1 Answer 1

Reset to default 0

Thanks @Filder, @Tiny Wang, @user29997358 for the insights.

As far I know, this is nearly impossible to achieve with multiple function projects under a single solution. It seems that deploying multiple function projects to a single Azure Function App may not be fully supported. You have to deploy each project to one instance separately.

Zip Deploy creates a .zip deployment package from the package and then deploys the file contents to the wwwroot folder of the Azure function app. This overwrites all existing content in the wwwroot folder.

  • A more straightforward approach for this would be to deploy each function project to its own Azure Function App. This would eliminate potential conflicts arising from shared resources and host.json files.

  • Consider consolidating the function projects into one. This way, you can deploy all functions together under a single host.json, avoiding the issues related to multiple host.json files.

Folder structure:

|   Function.cs
|   Function1.cs
|   FunctionApp21.csproj
|   FunctionApp21.csproj.user
|   host.json
|   local.settings.json
|   Program.cs
|   readme.md
|
+---bin
|   +---Debug
|   |   \---net9.0
  • To deploy multiple function projects within a single Azure Function App, make sure each function’s host.json is ideally at the root level, add compiled binaries together from both solutions and modify the path for scriptFile property in each of the function.json file to correct paths. Then deploy the final set of files to function app, refer SO answers.
发布评论

评论列表(0)

  1. 暂无评论