.net Azure功能2.0中的依赖项注入在从1.0升级后不起作用

.net Azure功能2.0中的依赖项注入在从1.0升级后不起作用,.net,azure,azure-functions,serverless,azure-functions-runtime,.net,Azure,Azure Functions,Serverless,Azure Functions Runtime,我已经创建了Azure函数应用程序,它工作正常,但当我将Azure函数版本从1.0更新到2.0时。我面临依赖注入错误。它在本地运行很好,但当我在Azure上发布它时,它出现了错误 2018-11-03T07:22:12.238[错误]错误索引方法“InviteFunctions.AcceptInvite” Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException:索引方法“InviteFunctions.AcceptInvit

我已经创建了Azure函数应用程序,它工作正常,但当我将Azure函数版本从1.0更新到2.0时。我面临依赖注入错误。它在本地运行很好,但当我在Azure上发布它时,它出现了错误

2018-11-03T07:22:12.238[错误]错误索引方法“InviteFunctions.AcceptInvite” Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException:索引方法“InviteFunctions.AcceptInvite”时出错-->System.InvalidOperationException:无法将参数“inviteService”绑定到类型IInviteService。确保绑定支持该参数类型。如果您正在使用绑定扩展(例如Azure存储、ServiceBus、计时器等),请确保已在启动代码中调用扩展的注册方法(例如builder.AddAzureStorage()、builder.AddServiceBus()、builder.AddTimers()等)。 在异步Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer.IndexMethodAsyncCore(MethodInfo方法,IFunctionIndexCollector索引,CancellationToken CancellationToken)的C:\projects\Azure-WebJobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Indexers\FunctionIndexer.cs:272 在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()中 在C:\projects\Azure-WebJobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Indexer\FunctionIndexer\FunctionIndexer.IndexMethodAsync(MethodInfo方法,IFunctionIndexCollector索引,CancellationToken CancellationToken)中的异步Microsoft.Azure.WebJobs.Host\Indexer\FunctionIndexer.cs:167 内部异常结束 在C:\projects\Azure-WebJobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Indexer\FunctionIndexer\FunctionIndexer.IndexMethodAsync(MethodInfo方法,IFunctionIndexCollector索引,CancellationToken CancellationToken)中的异步Microsoft.Azure.WebJobs.Host\Indexer\FunctionIndexer.cs:175 在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()中 在C:\projects\Azure-WebJobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Indexer\FunctionIndexer\FunctionIndexer.IndexTypeAsync(类型类型,IFunctionIndexCollector索引,CancellationToken CancellationToken)的异步Microsoft.Azure.WebJobs.Host\Indexer\FunctionIndexer.cs:103 2018-11-03T07:22:12.331[警告]函数“InviteFunctions.AcceptInvite”索引失败,将被禁用。 2018-11-03T07:22:12.331[错误]错误索引方法“InviteFunctions.Invites”


请帮助我

我们对v1和v2之间的依赖关系注入方式做了一些重大更改。这项工作是为了实现更大的灵活性,但也提供了一种向用户公开依赖项注入的方法。不过,这项工作仍在进行中,目标是在今年年底左右完成。虽然有一些人在GitHub中浏览了我们的绑定和触发器,但现在这是一个巨大的“无人地带”,如果你能避免的话,我建议你不要使用它。这是一个非常重要的问题。

我也有同样的问题。我不得不回去。我使用的方法是扩展属性类,但在尝试升级到2.0时失败。其他人可能会有更好的建议。请您将函数的代码发布在这里,以便更好地分析。