找不到工作职能。尝试公开您的工作类别和方法 [英] No job functions found. Try making your job classes and methods public

查看:97
本文介绍了找不到工作职能。尝试公开您的工作类别和方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我查看了具有相同错误消息的其他SO帖子,但似乎没有一个可以解决我的问题。我尝试了许多排列和选项。我的函数构建良好,但无法在CLI中运行,我收到以下神秘错误。 MSFT文档似乎也没有答案。

First off, I have looked at the other SO posts with the same error message and none seem to resolve my issue. I have tried many permutations and options. My function builds fine but will not run in the CLI, I get the following cryptic error. The MSFT documentation does not seem to have the answers either.


未找到作业功能。尝试公开您的工作类别和方法。如果您正在使用绑定扩展(例如ServiceBus,Timer等),请确保已在启动代码中调用了扩展的注册方法(例如config.UseServiceBus(),config.UseTimers()等)。 。)。

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.).

我正在尝试运行计时器作业,然后将一系列消息写入事件中心。我想念什么?我已经为此战斗了好几个小时。

I am trying to run a timer job and then write a collection of messages to an event hub. What am I missing? I have been fighting this for hours.

功能:

    [FunctionName("CreateData")]
    public static async Task Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer,
        [EventHub("murraytest", Connection = "evingest")] IAsyncCollector<string> myeventhub,
        TraceWriter log)
    {
        await myeventhub.AddAsync("data1");
        await myeventhub.AddAsync("data2");
        await myeventhub.AddAsync("data3");

        log.Info($"COMPLETED: {DateTime.Now}");
    }

local.settings.json:

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "Eventhub": "UseDevelopmentStorage=true",
    "AzureWebJobsDashboard": "",
    "evingest": "Endpoint=sb://example.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=LtcqBLT5VWjg0dGMdIvxCcEGs8902010Y6y14iGg="

  }
}

包装

function.json -缺少任何eventhub绑定!

function.json - is missing any eventhub bindings!

{
  "generatedBy": "Microsoft.NET.Sdk.Functions-1.0.0.0",
  "configurationSource": "attributes",
  "bindings": [
    {
      "type": "timerTrigger",
      "schedule": "0 */5 * * * *",
      "useMonitor": true,
      "runOnStartup": false,
      "name": "myTimer"
    }
  ],
  "disabled": false,
  "scriptFile": "..\\bin\\AzFuncs.dll",
  "entryPoint": "AzFuncs.Function1.Run"
}


推荐答案

您应该升级到最新的 Microsoft.NET.Sdk.Functions (今天为 1.0.6 )和 Microsoft.Azure.WebJobs。 Service.Bus (如果在完整框架上运行,则为 2.1.0-beta4 )。您可能需要先删除ServiceBus参考才能升级SDK。

You should upgrade to the latest Microsoft.NET.Sdk.Functions (1.0.6 as of today) and Microsoft.Azure.WebJobs.Service.Bus (2.1.0-beta4 if running on full framework). You might need to remove the ServiceBus reference first in order to upgrade SDK.

Microsoft.Azure.Eventhubs 包也需要删除。所有相关类型均在 Microsoft.Azure.WebJobs.Service.Bus

The Microsoft.Azure.Eventhubs package also needs to be removed. All relevant types etc are in Microsoft.Azure.WebJobs.Service.Bus

中,还请记得选中包括预发行版 ,以便找到 2.1.0-beta4

Also remember to check "Include prerelease" in the package manager in order to find 2.1.0-beta4.

这篇关于找不到工作职能。尝试公开您的工作类别和方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆