我使用带有 Azure Functions V1 的 Azure Functions 工具创建了一个全新的项目:
然后我按 F5 并得到黄色闪电,然后出现错误消息:
" An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = WebScriptHostManager (DelegateActivator), Services = [Microsoft.Azure.WebJobs.Script.WebHost.WebScriptHostManager], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = ExternallyOwned ---> The type initializer for 'Microsoft.Azure.WebJobs.Script.Utility' threw an exception. (See inner exception for details.)
"
我的设置是:
视觉工作室 2017 - 15.6.7
Azure SDK 功能 1.0.12
Azure 函数 V1
Azure Web 作业工具 - 15.0.40215.0
Azure CLI 1.0.12
这是我的 VS 控制台的输出:
func.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\func.exe'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\Autofac.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\System.IO.Abstractions.dll'. Cannot find or open the PDB file.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Newtonsoft.Json\9.0.0.0__30ad4fe6b2a6aeed\Newtonsoft.Json.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\ARMClient.Authentication.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\ARMClient.Library.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\Colors.Net.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\Microsoft.Azure.WebJobs.Script.dll'. Cannot find or open the PDB file.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\Microsoft.Extensions.Logging.Abstractions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Runtime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\Microsoft.Azure.WebJobs.Host.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Net.Http\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Net.Http.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\Microsoft.Azure.WebJobs.Script.WebHost.dll'. Cannot find or open the PDB file.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\FluentCommandLineParser.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'Anonymously Hosted DynamicMethods Assembly'.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\System.Web.Http.SelfHost.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\System.Web.Http.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel\v4.0_4.0.0.0__b77a5c561934e089\System.ServiceModel.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\System.Net.Http.Formatting.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\System.Web.Http.Cors.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\Ignite.SharpNetSH.dll'. Cannot find or open the PDB file.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Microsoft.CSharp\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.CSharp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Dynamic\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Dynamic.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.IdentityModel\v4.0_4.0.0.0__b77a5c561934e089\System.IdentityModel.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\SMDiagnostics\v4.0_4.0.0.0__b77a5c561934e089\SMDiagnostics.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Internals\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Internals.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\Autofac.Integration.WebApi.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\Microsoft.AspNet.WebHooks.Receivers.Generic.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\Microsoft.AspNet.WebHooks.Receivers.Azure.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\Microsoft.AspNet.WebHooks.Receivers.Pusher.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\Microsoft.AspNet.WebHooks.Receivers.Stripe.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\Microsoft.AspNet.WebHooks.Receivers.Trello.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\Microsoft.AspNet.WebHooks.Receivers.DynamicsCRM.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\Microsoft.AspNet.WebHooks.Receivers.MailChimp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\Microsoft.AspNet.WebHooks.Receivers.Slack.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\Microsoft.AspNet.WebHooks.Receivers.Bitbucket.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\Microsoft.AspNet.WebHooks.Receivers.Dropbox.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\Microsoft.AspNet.WebHooks.Receivers.WordPress.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\Microsoft.AspNet.WebHooks.Receivers.GitHub.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\Microsoft.AspNet.WebHooks.Receivers.Salesforce.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\Microsoft.Azure.AppService.Proxy.Common.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\Microsoft.Azure.WebJobs.Extensions.Http.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\Microsoft.AspNet.WebHooks.Receivers.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\Microsoft.Azure.WebJobs.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\Microsoft.WindowsAzure.Storage.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\Microsoft.AspNet.WebHooks.Common.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\System.Reactive.Linq.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\System.Reactive.Interfaces.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'func.exe' (CLR v4.0.30319: func.exe): Loaded 'C:\Users\Stanley\AppData\Local\Azure.Functions.Cli\1.0.12\System.Reactive.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The program '[15204] func.exe' has exited with code -1073741510 (0xc000013a).
我尝试过:卸载并重新安装 Azure Dev 工作负载以及 CLI 工具我没有尝试卸载/重新安装 VS,因为这至少需要半天时间。
我怀疑问题出在 Azure CLI
我对 Azure Functions + VS 感到非常沮丧。让他的东西工作起来绝对是一场噩梦!