问题描述
我正在使用 Visual Studio 2019 开发一个使用 Azure 函数 v3.0 的 Azure 函数应用.我实现了一个时间触发的功能.我想更改内容时间表"在 function.json:
function.json 文件:
我之前的回答确实是对的,我操作的时候.经过大量测试,我认为是因为微软官方更新.如果你也有兴趣,可以尝试使用之前的azure函数进行测试.
再次提醒您,修改function.json文件也会修改发布文件的.dll,即您修改的TimerTrigger时间不会生效.
让我描述一下我的最新进展.
创建一个新的天蓝色函数.也可以使用前面的,记得删除
SCM_DO_BUILD_DURING_DEPLOYMENT和WEBSITE_RUN_FROM_PACKAGE这两个配置.使用
func azure functionapp publish function_app_name --csharp --nozip --force命令发布您的函数应用.step 1. 使用cd命令进入包含host.json文件的文件夹.步骤 2. 使用
func azure functionapp publish function_app_name --csharp --nozip --force部署您的函数应用.如果中间有错误信息,可以忽略.我的屏幕截图显示了
NativeCommandError.只要最终结果已经上传成功.打开 scm 网站或使用应用服务编辑器(预览版),进行测试.
检查函数是否可以正常运行,经测试可以正常运行.
以前的
我重新创建了一个 func,发现我现在无法修改 function.json.
我有办法让你修改function.js文件,但是修改不会生效.
原则:
当我们使用vs2019发布时,代码中的这一行
public static void Run([TimerTrigger("*/15 * * * * *")]TimerInfo myTimer, TraceWriter 日志)编译后生成.dll文件.生成的function.json文件只是这个Function的属性和内容.修改后.dll文件不会被修改所以不会生效.
以上结论是通过测试得出的.
如何实现function.json文件可以修改
添加
SCM_DO_BUILD_DURING_DEPLOYMENT=true.删除
WEBSITE_RUN_FROM_PACKAGE配置,或修改为0.刷新scm站点,如果wwwroot下的文件被删除,请使用vs2019重新部署功能app.
重复第二步,然后修改
function.json文件即可成功.
以上只允许在发布后修改内容,修改时间不生效,因为.dll还没有被修改过.
I'm using Visual Studio 2019 to develop an Azure function app using Azure function v3.0. I implemented a time-triggered function. I want to change the content "schedule" in the function.json:
function.json file:
My previous answer is indeed correct, when I operate. After a lot of testing, I think it is because of the official Microsoft update. If you are also interested, you can try to use the previous azure function for testing.
Remind you again that modifying the function.json file will also modify the .dll of the released file, that is, the TimerTrigger time you modified will not take effect.
Let me describe my latest progress.
Create a new azure function. You can also use the previous ones, remember to delete the two configurations
SCM_DO_BUILD_DURING_DEPLOYMENTandWEBSITE_RUN_FROM_PACKAGE.Use the
func azure functionapp publish function_app_name --csharp --nozip --forcecommand to publish your function app. step 1. Use cd command enters the folder that contains thehost.jsonfile.step 2. Use
func azure functionapp publish function_app_name --csharp --nozip --forceto deploy your function app.If there is an error message in the middle, you can ignore it. My screenshot shows
NativeCommandError. As long as the final result has Upload completed successfully.Open the scm website or use App Service Editor (Preview) ,carry out testing.
Check whether the function can run normally, and it can run normally after testing.
PREVIOUS
I recreate a func, and find I can't modify function.json now. Maybe it fixed in 4.1.
Now it impossible to create a new one and modify it.
Below function I created before.
I have a way for you to modify the function.js file, but the modification will not take effect.
Principle:
When we use vs2019 for publishing, this line in the code
public static void Run([TimerTrigger("*/15 * * * * *")]TimerInfo myTimer, TraceWriter log)
After compiling, the .dll file is generated. The generated function.json file is only the properties and content of this Function. After the modification, the .dll file will not be modified so it will not take effect.
The above conclusions are drawn through testing.
How to realize that the function.json file can be modified
Add
SCM_DO_BUILD_DURING_DEPLOYMENT=true.Delete the
WEBSITE_RUN_FROM_PACKAGE configuration, or modify it to0.Refresh the scm site, if the files under wwwroot are deleted, please use vs2019 redeploy function app.
Repeat the second step, and then modify the
function.jsonfile to succeed.
The above is only allowed to modify the content after the release, the modified time does not take effect, because the .dll has not been modified.
这篇关于如何在 Azure 函数应用中调用函数后动态更改内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)