Azure API 管理层返回 "Setting 'config.db.connection' could not be found."
Azure API Management returning "Setting 'config.db.connection' could not be found."
我们通过 Azure API 管理公开了一些 Azure Functions。这些函数在直接调用时起作用,Api 管理中的端点也曾经起作用。现在,当我们调用 api 管理端点时,它们 return
[ConfigurationErrorsException: Setting 'config.db.connection' could not be found.]
Microsoft.Azure.ApiManagement.Infra.Configuration.SettingsProviderExtensions.GetSetting(ISettingsProvider provider, String name) in e:\Checkin package\AAPT\APIM\Infra\Infra\src\Infra\Configuration\SettingsProviderExtensions.cs:19
Microsoft.WindowsAzure.ApiManagement.Proxy.Api.Settings.get_SqlConnectionString() in D:\Checkin-Master\AAPT\APIManagement\Proxy\Api\Service\Settings.cs:43
Microsoft.Azure.ApiManagement.Gateway.IoC.Modules.c.b__0_0(IComponentContext c) in D:\Checkin-Master\AAPT\APIManagement\Proxy\Gateway.IoC\Modules\SqlConfigurationModule.cs:38
Autofac.c__DisplayClass10`1.b__f(IComponentContext c, IEnumerable`1 p) +10
Autofac.Builder.c__DisplayClass1`1.b__0(IComponentContext c, IEnumerable`1 p) +14
Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +32
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +48
Autofac.Core.Resolving.InstanceLookup.b__0() +8
Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +120
Autofac.Core.Resolving.InstanceLookup.Execute() +132
Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +133
Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +24
Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance) +74
Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters) +54
Autofac.ResolutionExtensions.Resolve(IComponentContext context, IEnumerable`1 parameters) +118
Microsoft.Azure.ApiManagement.Gateway.IoC.Modules.c.b__0_4(IComponentContext c) in D:\Checkin-Master\AAPT\APIManagement\Proxy\Gateway.IoC\Modules\ConfigurationModule.cs:116
Autofac.c__DisplayClass10`1.b__f(IComponentContext c, IEnumerable`1 p) +10
Autofac.Builder.c__DisplayClass1`1.b__0(IComponentContext c, IEnumerable`1 p) +14
Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +32
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +48
Autofac.Core.Resolving.InstanceLookup.b__0() +8
Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +120
Autofac.Core.Resolving.InstanceLookup.Execute() +132
Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +133
Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +24
Autofac.Core.Activators.Reflection.c__DisplayClass2.b__0() +25
Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +94
Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +174
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +48
Autofac.Core.Resolving.InstanceLookup.b__0() +8
Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +120
Autofac.Core.Resolving.InstanceLookup.Execute() +132
Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +133
Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) +44
[DependencyResolutionException: An exception was thrown while executing a resolve operation. See the InnerException for details. ---> Setting 'config.db.connection' could not be found. (See inner exception for details.)]
Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) +112
Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +109
Autofac.Core.Container.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +14
Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance) +74
Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters) +54
Autofac.ResolutionExtensions.Resolve(IComponentContext context, IEnumerable`1 parameters) +118
Autofac.ResolutionExtensions.Resolve(IComponentContext context) +75
Microsoft.Azure.ApiManagement.Gateway.Host.SystemWeb.GatewayStartup.Configuration(IAppBuilder app) in D:\Checkin-Master\AAPT\APIManagement\Proxy\Gateway.Host.SystemWeb\GatewayStartup.cs:75
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +160
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +101
Owin.Loader.c__DisplayClass12.b__b(IAppBuilder builder) +66
Owin.Loader.c__DisplayClass1.b__0(IAppBuilder builder) +123
Microsoft.Owin.Host.SystemWeb.c__DisplayClass2.b__0(IAppBuilder builder) +71
Microsoft.Owin.Host.SystemWeb.OwinAppContext.Initialize(Action`1 startup) +462
Microsoft.Owin.Host.SystemWeb.OwinBuilder.Build(Action`1 startup) +40
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +70
System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +115
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +106
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +523
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +176
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +220
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +303
[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +658
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +89
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +189
哪里缺少这个 db.connection 设置?
我猜你用的是消费sku。 Apim 在升级时有一个错误。这不应该再发生了。
我们通过 Azure API 管理公开了一些 Azure Functions。这些函数在直接调用时起作用,Api 管理中的端点也曾经起作用。现在,当我们调用 api 管理端点时,它们 return
[ConfigurationErrorsException: Setting 'config.db.connection' could not be found.] Microsoft.Azure.ApiManagement.Infra.Configuration.SettingsProviderExtensions.GetSetting(ISettingsProvider provider, String name) in e:\Checkin package\AAPT\APIM\Infra\Infra\src\Infra\Configuration\SettingsProviderExtensions.cs:19 Microsoft.WindowsAzure.ApiManagement.Proxy.Api.Settings.get_SqlConnectionString() in D:\Checkin-Master\AAPT\APIManagement\Proxy\Api\Service\Settings.cs:43 Microsoft.Azure.ApiManagement.Gateway.IoC.Modules.c.b__0_0(IComponentContext c) in D:\Checkin-Master\AAPT\APIManagement\Proxy\Gateway.IoC\Modules\SqlConfigurationModule.cs:38 Autofac.c__DisplayClass10`1.b__f(IComponentContext c, IEnumerable`1 p) +10 Autofac.Builder.c__DisplayClass1`1.b__0(IComponentContext c, IEnumerable`1 p) +14 Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +32 Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +48 Autofac.Core.Resolving.InstanceLookup.b__0() +8 Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +120 Autofac.Core.Resolving.InstanceLookup.Execute() +132 Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +133 Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +24 Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance) +74 Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters) +54 Autofac.ResolutionExtensions.Resolve(IComponentContext context, IEnumerable`1 parameters) +118 Microsoft.Azure.ApiManagement.Gateway.IoC.Modules.c.b__0_4(IComponentContext c) in D:\Checkin-Master\AAPT\APIManagement\Proxy\Gateway.IoC\Modules\ConfigurationModule.cs:116 Autofac.c__DisplayClass10`1.b__f(IComponentContext c, IEnumerable`1 p) +10 Autofac.Builder.c__DisplayClass1`1.b__0(IComponentContext c, IEnumerable`1 p) +14 Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +32 Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +48 Autofac.Core.Resolving.InstanceLookup.b__0() +8 Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +120 Autofac.Core.Resolving.InstanceLookup.Execute() +132 Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +133 Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +24 Autofac.Core.Activators.Reflection.c__DisplayClass2.b__0() +25 Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +94 Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +174 Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +48 Autofac.Core.Resolving.InstanceLookup.b__0() +8 Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +120 Autofac.Core.Resolving.InstanceLookup.Execute() +132 Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +133 Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) +44 [DependencyResolutionException: An exception was thrown while executing a resolve operation. See the InnerException for details. ---> Setting 'config.db.connection' could not be found. (See inner exception for details.)] Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) +112 Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +109 Autofac.Core.Container.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +14 Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance) +74 Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters) +54 Autofac.ResolutionExtensions.Resolve(IComponentContext context, IEnumerable`1 parameters) +118 Autofac.ResolutionExtensions.Resolve(IComponentContext context) +75 Microsoft.Azure.ApiManagement.Gateway.Host.SystemWeb.GatewayStartup.Configuration(IAppBuilder app) in D:\Checkin-Master\AAPT\APIManagement\Proxy\Gateway.Host.SystemWeb\GatewayStartup.cs:75 [TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0 System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +160 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +101 Owin.Loader.c__DisplayClass12.b__b(IAppBuilder builder) +66 Owin.Loader.c__DisplayClass1.b__0(IAppBuilder builder) +123 Microsoft.Owin.Host.SystemWeb.c__DisplayClass2.b__0(IAppBuilder builder) +71 Microsoft.Owin.Host.SystemWeb.OwinAppContext.Initialize(Action`1 startup) +462 Microsoft.Owin.Host.SystemWeb.OwinBuilder.Build(Action`1 startup) +40 Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +70 System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +115 Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +106 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +523 System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +176 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +220 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +303 [HttpException (0x80004005): Exception has been thrown by the target of an invocation.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +658 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +89 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +189
哪里缺少这个 db.connection 设置?
我猜你用的是消费sku。 Apim 在升级时有一个错误。这不应该再发生了。