简体   繁体   English

Azure function 启动时出错:无法访问已处置的 object。Object 名称:'IServiceProvider'

[英]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.

相关问题 AutoMapper IValueResolver:无法访问已处理的对象。 对象名称:&#39;IServiceProvider&#39; - AutoMapper IValueResolver: Cannot access a disposed object. Object name: 'IServiceProvider' 无法访问已处置的 object。 Object 名称:AspNet Core/EF Core 项目中出现“IServiceProvider”错误 - Cannot access a disposed object. Object name: 'IServiceProvider' error in AspNet Core/EF Core project 无法访问已处置的 object。 Object 名称:“IServiceProvider”,同时使用后台队列 - Cannot access a disposed object. Object name: 'IServiceProvider' while working with background queue ObjectDisposedException:无法访问已处置的对象。 对象名称:“调度程序” - ObjectDisposedException: Cannot access a disposed object. Object name: 'Dispatcher' C#&#39;无法访问已处置的对象。 对象名称:“ SslStream”。 - C# 'Cannot access a disposed object. Object name: 'SslStream'.' HangFire“无法访问已处置的对象。对象名称:'SqlDelegatedTransaction'” - HangFire "Cannot access a disposed object. Object name: 'SqlDelegatedTransaction'" 无法访问已处置的对象。 对象名称:&#39;tlsxyz&#39; - Cannot access a disposed object. Object name: 'tlsxyz' 无法访问已处置的对象。 对象名称:“ NumericUpDown” - Cannot access a disposed object. Object name: 'NumericUpDown' 无法访问已处置的对象。\\ r \\ n对象名称:“ ApplicationUserManager” - Cannot access a disposed object.\r\nObject name: 'ApplicationUserManager' 尝试运行SpecFlow NUnit测试时出错:“无法访问已处置的对象。 对象名称:“ GherkinLanguageService”” - Error when attempting to run SpecFlow NUnit test: “Cannot access a disposed object. Object name: 'GherkinLanguageService'”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM