web.config 中的奇怪配置错误

Strange Configuration Error in web.config

我的 WebApi 应用程序出现以下错误:

An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error Message: Unrecognized attribute 'MaxCachedResults'. Note that attribute names are case-sensitive.

这是我在 web.config 中的 roleManager 条目,如您所见,我没有指定 MaxCachedResults 属性,虽然我最初添加了这个,但我删除了它,所以它不是不再使用,我不确定它是从哪里获取的。

<roleManager enabled="true" defaultProvider="MyRoleProvider" cacheRolesInCookie="false">
  <providers>
    <clear />
    <add name="MyRoleProvider" type="SiteWorksAPI.RoleProviders.MyRoleProvider, SiteWorksAPI" connectionStringName="SiteWorks" applicationName="/" />
  </providers>
</roleManager>

错误发生在我调用 var resp = await _httpClient.GetAsync(resourceUri) 并检查 resp.Content.ReadAsStringAsync().Result 时显示带有上述错误消息的 'Configuration Error' HTML 页面。

我已经尝试了以下所有方法并取得了成功:

有人知道这里发生了什么吗?

似乎 Castle Windsor 正在缓存 web.config 文件的旧副本。更改 WebRequestHandler 上的缓存选项后,我能够让 HttpClient 获取新的 web.config 文件。