简体   繁体   English

函数的侦听器无法启动。 为什么?

[英]The listener for function was unable to start. Why?

I'm getting the following error when I run the azure function from visual studio.从 visual studio 运行 azure 函数时出现以下错误。

A ScriptHost error has occurred [1/19/2018 6:40:52 AM] The listener for function 'MyFunctionName' was unable to start.发生 ScriptHost 错误 [1/19/2018 6:40:52 AM] 函数“MyFunctionName”的侦听器无法启动。 Microsoft.WindowsAzure.Storage: Server encountered an internal error. Microsoft.WindowsAzure.Storage:服务器遇到内部错误。 Please try again after some time.请稍后重试。

When I run from the command prompt by running func host start command.当我通过运行func host start命令从命令提示符运行时。 I get the following warning.我收到以下警告。 and then it gets stuck on然后它卡住了

Host lock lease acquired by instance ID通过实例 ID 获取的主机锁租约

. .

No job functions found.找不到工作职能。 Try making your job classes and methods public.尝试公开您的作业类和方法。 If you're using binding extensions (eg ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (eg config.UseServiceBus(), config.UseTimers(), etc.).如果您正在使用绑定扩展(例如 ServiceBus、Timers 等),请确保您已经在启动代码中调用了扩展的注册方法(例如 config.UseServiceBus()、config.UseTimers() 等) .).

Azure function version: azure-functions-core-tools@2.0.1-beta.22 I'm using Storage Accounts Blob containers and queues. Azure 函数版本: azure-functions-core-tools@2.0.1-beta.22我正在使用存储帐户 Blob 容器和队列。

I'm connecting to Development Storage account , I have checked it that storage emulator is started.我正在连接到Development Storage account ,我已经检查过存储模拟器已启动。

{
  "IsEncrypted": false,
  "Values": {
    "ConnectionStrings:Default": "Server=.\\SQLEXPRESS; Database=TestDb; Trusted_Connection=True;",
    "ConnectionStrings:BlobStorageAccount": "UseDevelopmentStorage=true",

    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "AzureWebJobsDashboard": "UseDevelopmentStorage=true",
  }
}

FYI.供参考。

It was working fine before, But I have got this message in Visual Studio.之前它工作正常,但我在 Visual Studio 中收到了这条消息。

your license has gone stale and must be updated.您的许可证已经过时,必须更新。 Check for an updated license to continue using this product检查更新的许可证以继续使用该产品

So I just deleted the %localappdata% and %temp% , then I tried to run Azure function and after this, I have started getting所以我只是删除了%localappdata%%temp% ,然后我尝试运行 Azure 功能,在此之后,我开始获得

The listener for function was unable to start error函数的侦听器无法启动错误

So is it related to my visual studio subscription or I mistakenly deleted any required file?那么它与我的 visual studio 订阅有关还是我错误地删除了任何需要的文件? Or is this related to something else?或者这与其他事情有关?

For anyone that is encountering this issue the following may help...对于遇到此问题的任何人,以下内容可能会有所帮助...

Azure Durable Functions rely on TableStorage, and the latest version of Azurite (v3) currently doesn't support TableStorage. Azure Durable Functions 依赖于 TableStorage,而最新版本的 Azurite (v3) 目前不支持 TableStorage。 As such, pull the Azurite repo and switch to the legacy-master (v2) branch and then run npm run start .因此,拉取 Azurite 存储库并切换到legacy-master (v2) 分支,然后运行npm run start

if you are running via storage emulator locally then run func settings add AzureWebJobsStorage UseDevelopmentStorage=true in local.settings.json如果您在本地通过存储模拟器运行,则运行 func settings add AzureWebJobsStorage UseDevelopmentStorage=true in local.settings.json

and if with a normal Azure Storage connection string using func, must set the AzureWebJobsStorage in local.settings.json如果使用 func 使用普通 Azure 存储连接字符串,则必须在local.settings.json设置 AzureWebJobsStorage

for more view更多 观点

I just witnessed this.我刚刚见证了这一点。 This link https://github.com/Azure/azure-functions-core-tools/issues/357 indicates Local Storage Emulator may not be running.此链接https://github.com/Azure/azure-functions-core-tools/issues/357表示本地存储模拟器可能未运行。 I stopped debugging.我停止调试。 Went to the Cloud Explorer and opened the local nodes to see blob content.转到 Cloud Explorer 并打开本地节点以查看 blob 内容。 This must have started the Local storage emulator.这一定已经启动了本地存储模拟器。 When I hit run again, Azure Functions Tools started up.当我再次点击运行时,Azure Functions Tools 启动了。

For me this error was showing up because I didn't have Storage Emulator installed and running.对我来说,出现此错误是因为我没有安装和运行 Storage Emulator。 You can install Storage emulator as VS Code plugin from following link.您可以从以下链接将存储模拟器安装为 VS Code 插件。 After installing go to VS Code command palette and run Azurite: Start Blob Service .安装后转到 VS Code 命令面板并运行Azurite: Start Blob Service Then run your function locally.然后在本地运行您的函数。 It will work fine.它会正常工作。

https://marketplace.visualstudio.com/items?itemName=Azurite.azurite https://marketplace.visualstudio.com/items?itemName=Azurite.azurite

I am using VS-2022.我正在使用 VS-2022。 This issue was resolved using following steps.使用以下步骤解决了此问题。

  1. Run Azurite, in local machine, using below command使用以下命令在本地计算机中运行 Azurite

    azurite --silent --location c:\azurite --debug c:\azurite\debug.log azurite --silent --location c:\azurite --debug c:\azurite\debug.log

  2. In local.settings.json, use below code:在 local.settings.json 中,使用以下代码:

    "Values": { “价值观”:{

    "AzureWebJobsStorage": "UseDevelopmentStorage=true"} “AzureWebJobsStorage”:“UseDevelopmentStorage=true”}

  3. (optional), start the emulator and check that there is no error (可选),启动模拟器并检查没有报错

That's it!而已!

I was getting this issue when I was using ServiceBusTrigger in my Azure functions.我在 Azure 函数中使用ServiceBusTrigger时遇到了这个问题。

在此处输入图片说明

In my visual studio solution I had two Azure Functions and I was using the same Subscription Name for my two Functions, where one function is to send the data to the Azure Service Bus and the other is for receiving the data.在我的 Visual Studio 解决方案中,我有两个Azure Functions并且我为我的两个 Functions 使用了相同的Subscription Name ,其中一个功能是将数据发送到 Azure 服务总线,另一个是接收数据。

To Send发送

private const string _topicName = "factfinder_topic";
private const string _subscriptionName = "subs1";
private static ITopicClient _topicClient;
private static ILogger _logger;
[FunctionName("SendDataToSubscription")]
public static void Run([ServiceBusTrigger(_topicName, _subscriptionName, Connection = "ServiceBusConnectionString")] string mySbMsg, ILogger log) {
    _logger = log;
    PrepareSend().GetAwaiter().GetResult();
    _logger.LogInformation($ "C# ServiceBus topic trigger function processed message: {mySbMsg}");
}

To Receive接受

private const string _topicName = "factfinder_topic";
private const string _subscriptionName = "subs1";
[FunctionName("FetchDataFromSubscription")]
public static void Run([ServiceBusTrigger(_topicName, _subscriptionName, Connection = "ServiceBusConnectionString")] string mySbMsg, ILogger log) {
    log.LogInformation($ "C# ServiceBus topic trigger function processed message: {mySbMsg}");
}

As you could see that the value of the _subscriptionName is subs1 in both case, and this is wrong, so after changing this to my other subscription name ( subs2 ) in the FetchDataFromSubscription function, the issue was resolved.正如您所看到的,在这两种情况下_subscriptionName的值都是subs1 ,这是错误的,因此在FetchDataFromSubscription函数中将其更改为我的其他订阅名称( subs2 ) 后,问题已解决。

I was also experiencing the same issue.我也遇到了同样的问题。 Exiting the Visual Studio and opening it again resolved the issue in my case.退出 Visual Studio 并再次打开它解决了我的问题。

I solved this problem by setting UseDevelopmentStorage=false in local.settings.json file.我通过在 local.settings.json 文件中设置UseDevelopmentStorage=false解决了这个问题。

{ {
"IsEncrypted": false, “IsEncrypted”:假,
"Values": { “价值观”:{
"FUNCTIONS_WORKER_RUNTIME": "python", "FUNCTIONS_WORKER_RUNTIME": "蟒蛇",
"AzureWebJobsStorage": "UseDevelopmentStorage=false" "AzureWebJobsStorage": "UseDevelopmentStorage=false"
} }
} }

I solved the issue doing the following steps: Open up a new terminal and type "azurite".我通过以下步骤解决了这个问题:打开一个新终端并输入“azurite”。 The program will open and keep the window opened.程序将打开并保持窗口打开。 Open visual studio and try to run the function again.打开 Visual Studio 并尝试再次运行该功能。 Voi la.瞧啦。

For anyone who bump in this kind of issue, please check this link .对于遇到此类问题的任何人,请查看此链接

After cleaning the azure storage local container, it solved the issue for me.清理 azure 存储本地容器后,它为我解决了这个问题。

For anyone else coming across this error when locally running durable functions I found the easiest way to deal with it was by using the VSCode extension "Durable Functions Monitor".对于在本地运行持久函数时遇到此错误的任何其他人,我发现处理它的最简单方法是使用 VSCode 扩展“持久函数监视器”。 I find this an excellent resource for durable functions;我发现这是持久功能的绝佳资源; using the extension I delete the hub in Azurite storage, which is fast.使用扩展我删除了 Azurite 存储中的集线器,这很快。 All the data from any previous executions is removed along with this error.任何先前执行的所有数据都与此错误一起被删除。

I had the problem too and spend many time.我也有这个问题,花了很多时间。 The fix is not from me but I hope the onwer can accepot it as solution it has spend me much time in past and it can help others.修复不是来自我,但我希望 onwer 可以接受它作为解决方案,它过去花了我很多时间,它可以帮助其他人。

The only working fix for me was written in the comment above:对我来说唯一有效的修复程序写在上面的评论中:

The timer in azure-webjobs-hosts was corrupt. azure-webjobs-hosts 中的计时器已损坏。 It was fixed after deleting the entry.删除条目后已修复。 – Marcel Gelijk Mar 5, 2021 at 9:59 – Marcel Gelijk 2021 年 3 月 5 日 9:59

On my cases it ssems to happened if you use a timer trigger and change many on them, make duplicates or switch the time trigger to http trigger and back.在我的情况下,如果您使用计时器触发器并对其进行许多更改,复制或将时间触发器切换到 http 触发器并返回,则可能会发生这种情况。 If you do som stuff for testing it could harm conflicting entries in azure-webjobs-hosts.如果你为测试做一些事情,它可能会损害 azure-webjobs-hosts 中的冲突条目。

So I delete all entries in locks and timers folder.所以我删除了 locks 和 timers 文件夹中的所有条目。 On starting your timer azure functions all Entries will renewed and it worked在启动计时器 azure 功能时,所有条目都将更新并且有效

Many thanks to Marcel Gelijk.非常感谢 Marcel Gelijk。

[ [ 删除这 2 个文件夹中的所有条目1

In my case I deleted everything inside %localappdata% and %temp% folders and started again.在我的例子中,我删除了 %localappdata% 和 %temp% 文件夹中的所有内容,然后重新开始。

solved by following this blog.通过关注此博客解决。

https://markgossa.com/2018/12/azure-function-listener-for-function.html https://markgossa.com/2018/12/azure-function-listener-for-function.html

"%programfiles(x86)%\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe" init "%programfiles(x86)%\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe" start "%programfiles(x86)%\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe" init "%programfiles(x86)%\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe" 启动

I'm getting the following error when I run the azure function from visual studio.当我从Visual Studio运行azure函数时,出现以下错误。

A ScriptHost error has occurred [1/19/2018 6:40:52 AM] The listener for function 'MyFunctionName' was unable to start.发生ScriptHost错误[1/19/2018 6:40:52 AM]无法启动函数'MyFunctionName'的侦听器。 Microsoft.WindowsAzure.Storage: Server encountered an internal error. Microsoft.WindowsAzure.Storage:服务器遇到内部错误。 Please try again after some time.请稍后再试。

When I run from the command prompt by running func host start command.当我从命令提示符运行func host start命令来运行func host start I get the following warning.我收到以下警告。 and then it gets stuck on然后卡在

Host lock lease acquired by instance ID通过实例ID获取主机锁租约

.

No job functions found.找不到作业功能。 Try making your job classes and methods public.尝试公开您的工作类别和方法。 If you're using binding extensions (eg ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (eg config.UseServiceBus(), config.UseTimers(), etc.).如果使用绑定扩展(例如ServiceBus,Timer等),请确保已在启动代码(例如config.UseServiceBus(),config.UseTimers()等)中调用了扩展的注册方法。 )。

Azure function version: azure-functions-core-tools@2.0.1-beta.22 I'm using Storage Accounts Blob containers and queues. Azure函数版本: azure-functions-core-tools@2.0.1-beta.22我正在使用存储帐户Blob容器和队列。

I'm connecting to Development Storage account , I have checked it that storage emulator is started.我正在连接到Development Storage帐户,已检查它是否已启动存储模拟器

{
  "IsEncrypted": false,
  "Values": {
    "ConnectionStrings:Default": "Server=.\\SQLEXPRESS; Database=TestDb; Trusted_Connection=True;",
    "ConnectionStrings:BlobStorageAccount": "UseDevelopmentStorage=true",

    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "AzureWebJobsDashboard": "UseDevelopmentStorage=true",
  }
}

FYI.供参考。

It was working fine before, But I have got this message in Visual Studio.以前工作正常,但是我在Visual Studio中收到了此消息。

your license has gone stale and must be updated.您的许可证已过时,必须更新。 Check for an updated license to continue using this product检查更新的许可证以继续使用该产品

So I just deleted the %localappdata% and %temp% , then I tried to run Azure function and after this, I have started getting所以我只删除了%localappdata%%temp% ,然后尝试运行Azure函数,然后,我开始获取

The listener for function was unable to start error函数的侦听器无法启动错误

So is it related to my visual studio subscription or I mistakenly deleted any required file?那么这与我的Visual Studio订阅有关还是我误删除了任何必需的文件? Or is this related to something else?还是这与别的东西有关?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 function 'IotHubTrigger' 的侦听器无法启动。 物联网中心 - The listener for function 'IotHubTrigger' was unable to start. IoTHub function 'functionName' 的侦听器无法启动。 &lt;--- 禁止 - The listener for function 'functionName' was unable to start. <--- Forbidden 函数的侦听器无法启动。 Azure 函数应用时间触发器 - Listener for function was unable to start. Azure function app timetrigger function '' 的侦听器无法启动。 Azure 耐用 function VS 2022 - The listener for function '' was unable to start. Azure durable function VS 2022 function 'Function1' 的侦听器在运行计时器时无法启动 function - The listener for function 'Function1' was unable to start when running a timer function Azure function 在 linux 上出现“侦听器无法启动”错误 - Azure function gets 'Listener unable to start' error on linux 函数“FunctionName”的侦听器无法在 .net core azure 中启动 - The listener for function 'FunctionName' was unable to start in .net core azure 无法在容器启动时更改某些 js/html 文件内容。 获取访问被拒绝异常 - Unable to change some js/html file content on container start. getting access denied exception 持久功能无法启动 - durable function unable to start “函数运行时无法启动” - "The function runtime is unable to start"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM