问题描述
AF运行时2.0.12332在VS 2017本地工作.但是它自动更改为2.0.12353,具有
如果可能的话,可能的解决方案,但是我如何实现呢?
1)在本地支持不同版本并运行特定版本,或者
2)卸载当前版本,然后重新安装corect版本
更新
由于缺乏IoC支持而导致的异常:
2019-03-15T01:28:45.311 [错误]已执行'测试'(失败,ID = 6bdb0e8e-2353-4ed2-83ce-2a5288fd124d)System.InvalidOperationException:在尝试激活"TestFunctions"时无法解析类型为"ICar"的服务.在Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetService(IServiceProvider sp,Type type,Type requiredBy,Boolean isDefaultParameterRequired)在lambda_method(Closure,IServiceProvider,Object [])在Microsoft.Azure.WebJobs.Host.Executors.DefaultJobActivator.CreateInstance [T](IServiceProvider serviceProvider)在C:\ projects \ azure-webjobs-sdk-rqm4t \ src \ Microsoft.Azure.WebJobs.Host \ Executors \ DefaultJobActivator.cs:42在Microsoft.Azure.WebJobs.Host.Executors.DefaultJobActivator.CreateInstance [T](IFunctionInstanceEx functionInstance)在C:\ projects \ azure-webjobs-sdk-rqm4t \ src \ Microsoft.Azure.WebJobs.Host \ Executors \ DefaultJobActivator.cs:32在Microsoft.Azure.WebJobs.Host.Executors.ActivatorInstanceFactory`1处.cct.DisplayClass1_1.ctor b__0(IFunctionInstanceEx i)在C:\ projects \ azure-webjobs-sdk-rqm4t \ src \ Microsoft.Azure.WebJobs.Host \ Executors \ ActivatorInstanceFactory.cs:20在Microsoft.Azure.WebJobs.Host.Executors.ActivatorInstanceFactory的1.Create(IFunctionInstanceEx functionInstance)在C:\ projects \ azure-webjobs-sdk-rqm4t \ src \ Microsoft.Azure.WebJobs.Host \ Executors \ ActivatorInstanceFactory.cs:26位于Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`2.CreateInstance(IFunctionInstanceEx functionInstance)位于C:\ projects \ azure-webjobs-sdk-rqm4t \ src \ Microsoft.Azure.WebJobs.Host \ Executors \ FunctionInvoker.cs:44在Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ParameterHelper.Initialize()在C:\ projects \ azure-webjobs-sdk-rqm4t \ src \ Microsoft.Azure.WebJobs.Host \ Executors \ FunctionExecutor.cs:845在异步Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.TryExecuteAsyncCore(IFunctionInstanceEx functionInstance,CancellationToken cancellingToken)在C:\ projects \ azure-webjobs-sdk-rqm4t \ src \ Microsoft.Azure.WebJobs.Host \ Executors \ FunctionExecutor中.CS:116
要解决Azure Functions上的运行时问题,请参见
AF runtime 2.0.12332 was working locally with VS 2017. But it is automatically changed to 2.0.12353, which has issues.
How can I change to 2.0.12332 or other version that supports DI via ctor on local station?
Possible solutions if possible, but how can I achieve it?
1) support different versions locally and run specific version, or
2) un-install current version, and re-install corect version
Update
Exception caused by the lack of IoC support:
2019-03-15T01:28:45.311 [Error] Executed 'Test' (Failed, Id=6bdb0e8e-2353-4ed2-83ce-2a5288fd124d)
System.InvalidOperationException : Unable to resolve service for type 'ICar' while attempting to activate 'TestFunctions'.
at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetService(IServiceProvider sp,Type type,Type requiredBy,Boolean isDefaultParameterRequired)
at lambda_method(Closure ,IServiceProvider ,Object[] )
at Microsoft.Azure.WebJobs.Host.Executors.DefaultJobActivator.CreateInstance[T](IServiceProvider serviceProvider) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\DefaultJobActivator.cs : 42
at Microsoft.Azure.WebJobs.Host.Executors.DefaultJobActivator.CreateInstance[T](IFunctionInstanceEx functionInstance) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\DefaultJobActivator.cs : 32
at Microsoft.Azure.WebJobs.Host.Executors.ActivatorInstanceFactory`1.<>c__DisplayClass1_1.<.ctor>b__0(IFunctionInstanceEx i) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\ActivatorInstanceFactory.cs : 20
at Microsoft.Azure.WebJobs.Host.Executors.ActivatorInstanceFactory`1.Create(IFunctionInstanceEx functionInstance) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\ActivatorInstanceFactory.cs : 26
at Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`2.CreateInstance(IFunctionInstanceEx functionInstance) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionInvoker.cs : 44
at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ParameterHelper.Initialize() at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs : 845
at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.TryExecuteAsyncCore(IFunctionInstanceEx functionInstance,CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs : 116
To fix the runtime issue on Azure Functions, see Depdency Injection and Logging start failing suddently without code changes when they were working properly with Azure Functions
To fix the runtime issue on Azure Functions, see Depdency Injection and Logging start failing suddently without code changes when they were working properly with Azure Functions
Solution 1
1 download thishttps://github.com/Azure/azure-functions-core-tools/releases/tag/2.4.419
2 Replace files from step 1 to below
%AppData%\..\Local\AzureFunctionsTools\Releases\2.18.4\cli
2.18.4
might be different from your current folder. Check this to see your current folder
1 Download and extract the latest x64 1.x release from here https://github.com/Azure/azure-functions-core-tools/releases
2 Right click on your project Properties -> Debug
3 Change Launch to Executable, and put the path for the downloaded x64 func.exe
4 set Application arguments to host start
5 F5
这篇关于使用Visual Studio 2017为本地开发人员设置Azure Functions运行时版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!