[英]Azure function error on startup: Cannot access a disposed object. Object name: 'IServiceProvider'
I have 2 azure function project in my solution.我的解决方案中有 2 azure function 项目。
When I startup multiple projects from Visual Studio and start both azure functions projects, I have an error message当我从 Visual Studio 启动多个项目并启动两个 azure 函数项目时,出现错误消息
Cannot access a disposed object.
Object name: 'IServiceProvider'
But when i run separatly each azure function projet.但是当我分别运行每个 azure function 项目时。 I have no error.
我没有错误。
How to solve this?如何解决这个问题?
I have found the problem.我发现了问题。
The port is already taken (busy) so it s not possible to run 2 azure functions on the same port.该端口已被占用(繁忙),因此无法在同一端口上运行 2 个 azure 函数。
You can easily configure the host port via the properties page via debug tab then Application Arguments您可以通过调试选项卡的属性页面轻松配置主机端口,然后是应用程序 Arguments
host start --pause-on-error --port 7072
This is a article that explain this in details https://dev.to/azure/debugging-multiple-azure-functions-apps-at-the-same-time-1ka4这是一篇详细解释这一点的文章https://dev.to/azure/debugging-multiple-azure-functions-apps-at-the-same-time-1ka4
Note: If you upgrade to the Azure function V3, the error message is more explicit注意:如果升级到Azure function V3,报错信息更明确
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
</PropertyGroup>
// ...
</Project>
Et voilà;)瞧瞧;)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.