gpt4 book ai didi

Azure函数预编译timerTrigger错误

转载 作者:行者123 更新时间:2023-12-03 05:54:41 26 4
gpt4 key购买 nike

我部署了一个使用timerTrigger预编译的Azure Function。当我激活所有日志时出现以下异常

2017-04-13T12:53:03.836 {"id":"b91045c2-ff21-4c9d-bd14-88e90723adbe","requestId":"37212a13-73ae-4e1e-9f1e-130f3865e258","statusCode":500,"errorCode":0,"messsage":"Sequence contains no matching element"} 2017-04-13T12:53:03.836 System.InvalidOperationException: Sequence contains no matching element at System.Linq.Enumerable.First[TSource](IEnumerable1
source, Func
2 predicate) at Microsoft.Azure.WebJobs.Script.WebHost.Controllers.AdminController.Invoke(String name, FunctionInvocation invocation) at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.b__9(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken) --- End of stack trace from previous location where exception was thrown ---

我的函数.json

{
"scriptFile": "..\\bin\\Plop.Statistics.dll",
"entryPoint": "Plop.Statistics.S4BStatisticsCommand.Function.Run",
"bindings": [
{
"name": "myTimer",
"type": "timerTrigger",
"direction": "in",
"schedule": "0 */1 * * * *"
},
{
"name": "outputQueueItem",
"queueName": "command-queue",
"type": "queue",
"direction": "out",
"connection": "AzureWebJobsStorage"
}
],
"disabled": false
}

和我的功能

namespace Plop.Statistics.S4BStatisticsCommand{
public class Function
{
public static async Task Run(TimerInfo myTimer, ICollector<S4BStatisticCommand> outputQueueItem, TraceWriter log)
{
log.Info("hello");
}

感谢您的帮助!

编辑:

timerTrigger没有被触发,因为没有找到该函数。这里是日志:

2017-04-14T08:54:11.773 File change of type 'Created' detected for:\home\site\wwwroot\S4BStatisticsCommand'

2017-04-14T08:54:11.773 Host configuration has changed. Signaling restart

2017-04-14T08:54:12.167 File change of type 'Created' detected for 'D:\home\site\wwwroot\S4BStatisticsCommand\function.json'

2017-04-14T08:54:12.167 Host configuration has changed. Signaling restart

2017-04-14T08:54:12.281 File change of type 'Changed' detected for 'D:\home\site\wwwroot\S4BStatisticsCommand\function.json'

2017-04-14T08:54:12.281 Host configuration has changed. Signaling restart

2017-04-14T08:54:12.785 Stopping Host

2017-04-14T08:54:12.832 Job host stopped

2017-04-14T08:54:12.894 Host instance 'f3bf62b4fcd9d52410e4b055937d68db' released lock lease.

2017-04-14T08:54:12.957 Reading host configuration file 'D:\home\site\wwwroot\host.json'

2017-04-14T08:54:13.317 Host lock lease acquired by instance ID 'f3bf62b4fcd9d52410e4b055937d68db'.

2017-04-14T08:54:14.070 Generating 1 job function(s)

2017-04-14T08:54:14.097 Starting Host (HostId=4ab0f60d5dc84308a2fd847b978c468b, Version=1.0.10841.0, ProcessId=8628, Debug=True, Attempt=0)

2017-04-14T08:54:14.113 Development settings applied

2017-04-14T08:54:14.113 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.).

2017-04-14T08:54:14.113 Job host started

最佳答案

定时器触发器需要 Microsoft.Azure.WebJobs.Extensions nuget,作业主机应该注册您的函数。

查看此precompiled function article ,特别是“转换为类文件”部分。

  1. If you’re using timer triggers, add the NuGet package Microsoft.Azure.WebJobs.Extensions.

关于Azure函数预编译timerTrigger错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43393121/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com