[英]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.这种类型的问题通常是由三个原因造成的。
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.