【发布时间】:2021-04-29 21:19:38
【问题描述】:
我们有多个服务器,我们在 IIS 上托管 ASP.NET 网站。在网站中,我们尝试从 Azure KeyVault 获取值。
在一台服务器中,由于某种原因,它无法从 Azure KeyVault 读取值,并出现错误“指定的用户没有有效的配置文件”。我们已经完成了调查,仔细检查了配置,文件的权限 - 一切看起来都很好。还尝试在 IIS 中调整配置文件,但没有任何帮助。
这是堆栈跟踪:
Exception information:
Exception type: ConfigurationErrorsException
Exception message: An error occurred loading a configuration file: The specified user does not have a valid profile. Unable to load 'Microsoft.Configuration.ConfigurationBuilders.Azure, Version=2.0.0.0, Culture=neutral'. (D:\<website_path> line 77)
at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey, Boolean getLkg, Boolean checkPermission)
at System.Web.Util.AppSettings.GetAppSettingsSection()
at System.Web.Util.AppSettings.EnsureSettingsLoaded()
at System.Web.Util.AppSettings.get_PortableCompilationOutput()
at System.Web.Compilation.BuildManager.RestorePortableCompilationOutputSnapshot()
at System.Web.Compilation.BuildManager.ExecutePreAppStart()
at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)
The specified user does not have a valid profile. Unable to load 'Microsoft.Configuration.ConfigurationBuilders.Azure, Version=2.0.0.0, Culture=neutral'.
at System.Configuration.TypeUtil.GetTypeImpl(String typeString, Boolean throwOnError)
at System.Configuration.ConfigurationBuildersSection.InstantiateBuilder(ProviderSettings ps)
at System.Configuration.ConfigurationBuildersSection.GetBuilderFromName(String builderName)
at System.Configuration.BaseConfigurationRecord.GetSectionXmlReader(String[] keys, SectionInput input)
有没有人遇到过类似的问题?
任何帮助将不胜感激。
【问题讨论】:
-
在其他服务器上能成功获取值还是只有一台服务器?
-
@TheobaldDu 是的,我们有多个服务器,一切都在其他服务器上运行。
-
你能找到被推荐的用户没有有效的个人资料吗?此用户是否有权访问密钥保管库实例?错误发生在什么时候?无法访问密钥保管库或使用 null 或错误机密加载“Microsoft.Configuration.ConfigurationBuilders.Azure”的时间?
-
我的意思是你可以检查是否有一些错误导致用户的身份错误。请参阅this,如果您使用默认凭据可能会有所帮助。