简体   繁体   English

在 Visual Studio Pro 2017 中启动 Azure Function 时出错

[英]Error when start Azure Function in Visual Studio Pro 2017

when I want to start the Azure Function in 2017 the error comes up: I don't know why.当我想在 2017 年启动 Azure Function 时出现错误:我不知道为什么。

07.07.2020 20:21:57] Retrying to start listener for function 'Function1' (Attempt 5)
[07.07.2020 20:21:57] A ScriptHost error has occurred
[07.07.2020 20:21:57] The listener for function 'Function1' was unable to start. Microsoft.Azure.WebJobs.Extensions.DocumentDB: The listener has already been started or is starting.
[07.07.2020 20:21:57] The listener for function 'Function1' was unable to start. Microsoft.Azure.WebJobs.Extensions.DocumentDB: The listener has already been started or is starting.
[07.07.2020 20:21:57]
[07.07.2020 20:21:57] The listener for function 'Function1' was unable to start.
[07.07.2020 20:21:57] The listener for function 'Function1' was unable to start. Microsoft.Azure.WebJobs.Extensions.DocumentDB: The listener has already been started or is starting.

What should I do?我应该怎么办?

Thanks谢谢

Please show the local.settings.json of your function app.请显示您的 function 应用程序的 local.settings.json。 Maybe the connection string has some problem.也许连接字符串有问题。

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

When running the function locally, all triggers except httptrigger need to use the Storage Emulator.在本地运行 function 时,除 httptrigger 之外的所有触发器都需要使用 Storage Emulator。 If the firewall restricts the listener's access to virtual storage, problems can occur when performing functions.如果防火墙限制侦听器对虚拟存储的访问,则在执行功能时可能会出现问题。

Try disabling the firewall and see if that resolves the issue.尝试禁用防火墙,看看是否能解决问题。

Of course, it is also possible that the Storage Emulator service is not open.当然,也有可能是 Storage Emulator 服务没有打开。 Try typing尝试输入

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

in cmd to check the status.在 cmd 中检查状态。

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

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

To sum up:总结一下:

This type of problem is generally for three reasons.这类问题一般有三个原因。

1.Connection string error prevents connection, 1.连接字符串错误阻止连接,

2.firewall is set 2.防火墙设置

3.some services are not turned on. 3.部分服务未开启。

Please do the above steps and let me know whether you can solve this problem.:)请执行上述步骤,让我知道您是否可以解决此问题。:)

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM