简体   繁体   English

函数“FunctionName”的侦听器无法在 .net core azure 中启动

[英]The listener for function 'FunctionName' was unable to start in .net core azure

The app is running perfectly in my local using the emulator.该应用程序使用模拟器在我的本地完美运行。 But when i deploy to azure to test it, i get this error on the log.但是当我部署到 azure 进行测试时,我在日志中收到此错误。 I only have one function which is a time trigger.我只有一个功能是时间触发器。

[10/12/2021 02:32:22 > 79e06d: INFO] The listener for function 'DoWork' was unable to start. [10/12/2021 02:32:22 > 79e06d: INFO] 函数“DoWork”的监听器无法启动。 [10/12/2021 02:32:22 > 79e06d: INFO] Microsoft.Azure.WebJobs.Host.Listeners.FunctionListenerException: The listener for function 'DoWork' was unable to start. [10/12/2021 02:32:22 > 79e06d: INFO] Microsoft.Azure.WebJobs.Host.Listeners.FunctionListenerException:函数“DoWork”的侦听器无法启动。 [10/12/2021 02:32:22 > 79e06d: INFO] ---> System.Threading.Tasks.TaskCanceledException: A task was canceled. [10/12/2021 02:32:22 > 79e06d: INFO] ---> System.Threading.Tasks.TaskCanceledException:任务被取消。 [10/12/2021 02:32:22 > 79e06d: INFO] at Microsoft.Azure.Storage.Core.Executor.Executor.ExecuteAsync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext, CancellationToken token) [10/12/2021 02:32:22 > 79e06d: INFO] 在 Microsoft.Azure.Storage.Core.Executor.Executor.ExecuteAsync[T](RESTCommand`1 cmd,IRetryPolicy 策略,OperationContext operationContext,CancellationToken 令牌)

I have these on my appsettings我的应用设置中有这些

"AzureWebJobsStorage": "UseDevelopmentStorage=true", "FUNCTIONS_WORKER_RUNTIME": "dotnet", "AzureWebJobsStorage": "UseDevelopmentStorage=true", "FUNCTIONS_WORKER_RUNTIME": "dotnet",

If you use a locally virtualized Storage Emulator, then your Connecting String is correct.如果您使用本地虚拟化存储模拟器,那么您的连接字符串是正确的。

{
    "AzureWebJobsStorage": "UseDevelopmentStorage=true", 
    "FUNCTIONS_WORKER_RUNTIME": "dotnet"
}

If your firewall restricts function from accessing the Storage Account, then this error may be reported.如果您的防火墙限制功能访问存储帐户,则可能会报告此错误。 The firewall is one of the reason that the listener cannot access the virtual Storage Emulator.防火墙是监听器无法访问虚拟存储模拟器的原因之一。

When running the function locally, all triggers except http trigger need to use the Storage Emulator.在本地运行该函数时,除http触发器之外的所有触发器都需要使用存储模拟器。 If the firewall restricts the listener's access to virtual storage, problems can occur when performing functions.如果防火墙限制侦听器对虚拟存储的访问,则在执行功能时可能会出现问题。 That's why you don't get errors with http trigger, because it doesn't use a virtual Storage Emulator.这就是为什么使用 http 触发器不会出错的原因,因为它不使用虚拟存储模拟器。

Try disabling the firewall and see if that resolves the issue, Try the below statement in cmd to check the status尝试禁用防火墙,看看是否可以解决问题,在 cmd 中尝试以下语句以检查状态

"%programfiles(x86)%\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe" status

If it returns false, enter the following command to start the Storage Emulator:如果返回 false,请输入以下命令以启动存储模拟器:

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

This type of problem is generally for three reasons.这种类型的问题通常是由三个原因造成的。

  1. Connection string error prevents connection,连接字符串错误阻止连接,
  2. firewall is set防火墙已设置
  3. some services are not turned on.有些服务没有开启。 Try to copy the same code to a different location.尝试将相同的代码复制到不同的位置。

Install and run Azure Storage Emulator version 5.2 or later.安装并运行 Azure 存储模拟器 5.2 或更高版本。 Update the local.appsettings.json file with real Azure Storage Connection Strings.使用真实的 Azure 存储连接字符串更新 local.appsettings.json 文件。

 {
    "AzureWebJobsStorage": "copy the string in the config function on azure",           
 }

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

相关问题 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 Azure function 在 linux 上出现“侦听器无法启动”错误 - Azure function gets 'Listener unable to start' error on linux function 'IotHubTrigger' 的侦听器无法启动。 物联网中心 - The listener for function 'IotHubTrigger' was unable to start. IoTHub 函数的侦听器无法启动。 为什么? - The listener for function was unable to start. Why? function 'Function1' 的侦听器在运行计时器时无法启动 function - The listener for function 'Function1' was unable to start when running a timer function 依赖注入无法解析在 Azure 中运行的 .NET Core Function App 中的类型的服务 - Dependency Injection unable to resolve service for type in .NET Core Function App running in Azure 使用Azure Function(.NET Core)下载文件 - Using Azure Function (.NET Core) to Download a file Azure功能与.net核心2类库 - Azure function with .net core 2 class library
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM