问题标签 [asp-net-config-builders]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
asp.net - 使用配置生成器时未找到 providerName
网络配置
该ConnectionStringSettings
对象ProviderName
将是一个空字符串,而不是"System.Data.SqlClient"
or "System.Data.EntityClient"
。
和属性映射就好了Name
。ConnectionString
如果我configBuilders
从标签中删除属性,将填充提供程序名称。当然,正确的环境变量将不再被获取,但关键是 configBuilder 打破了这一点。
这是用于连接字符串的配置生成器:
c# - ASP.NET Core(单元测试未涵盖)是否存在任何运行时扫描以预填充 ELMAH?
我是一名独立开发人员,拥有一个大型 ASP Core 站点,充当复杂的博客思维导图。
除了单元测试之外,我需要帮助来创建基础清单和确保一切正常运行的方法。例子包括
- 以下链接(Razor 页面移动到新位置,并且类名与文件夹/命名空间不匹配)
- 变通办法的功能(./well-known working?)
- 关于可以在运行时验证的 ASP.NET 配置的怪癖(每个环境)
- 其他校验和()验证,例如 /healthcheck /status /load /opsapproval /iscorrectenvironment
- 获取服务依赖性和可用性或维护窗口(计划或通知)
在此我可以为常见的基于环境的部署注意事项添加特殊说明(如果..然后编辑主机文件并连接 VPN2,或向 Josh 发送电子邮件)
azure-functions - Azure Functions 配置 Key Vault 提供程序不起作用
我想使用 Azure Key Vault Provider 来填充我的应用配置。将Microsoft.Azure.Functions.Extensions 1.1.0与Azure.Extensions.AspNetCore.Configuration.Secrets结合使用,我的代码如下所示:
local.settings.json
启动.cs
函数.cs
现在当我调用
将记录的是秘密名称的文字值secret-name-of-key-vault-entry
。不是密钥保管库中的密钥值。
这绝对不是访问策略的问题,因为之前我使用相同的用户主体从同一个保管库手动查询机密。
我错过了什么?任何帮助表示赞赏。
asp.net - 如何将 ASP.NET 4.8 ConfigBuilders 与 web.config 的 system.serviceModel 部分一起使用
我有一个 ASP.NET 4.8 应用程序,我正在尝试将配置生成器集成到其中。我已经安装了 NuGet 包Microsoft.Configuration.ConfigurationBuilders.Environment
并将所需的部分添加到Web.config
(此处严重截断)。
当我运行应用程序时,我会从每个操作中得到一个 HTTP 500 响应,并带有 message Unrecognized attribute 'configBuilders'
。Visual Studio 中的 Intellisense 也突出显示configBuilders
并表示The configBuilders attribute is not allowed
.
如果我configBuilders
从应用程序中删除该属性,system.serviceModel
则可以正常运行,尽管该部分中的占位符当然都没有展开。
例如,如果我configBuilders
从另一个部分中删除该属性system.serviceModel
并将其添加到另一个部分,connectionStrings
则应用程序将运行并且该connectionStrings
部分中的占位符将被替换。
显然,该部分有些不同,system.serviceModel
但我不明白我可以做什么或如何解决它,以便我可以在那里替换占位符。
asp.net - 使用带有 system.webServer 重写部分的 configBuilders
我使用 IIS Url Rewrite 模块,该模块在system.webServer/rewrite
.
我正在尝试使用基本的Microsoft.Configuration.ConfigurationBuilders.EnvironmentConfigBuilder
configBuilder,mode="Expand"
以便可以将环境变量注入到我的<rewrite>
配置部分,如下所示:
我得到一个500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed.
没有堆栈跟踪或任何进一步信息的。Visual Studio 智能感知状态The "configBuilders" attribute is not allowed
,我猜这解释了 500 错误。
如果我尝试在重写配置中的任何其他级别,例如在子元素上,或者<providers>
然后我得到一个 500 错误 <provider>
<settings>
Unrecognized attribute 'configBuilders'
我也尝试将configBuilders
属性放在<system.webServer>
元素本身上,但仍然存在错误。
据我所知,该属性只configBuilders
需要继续configSection
。这意味着system.webServer
因为它是一个configSectionGroup
. 理论上,rewrite
应该是一个configSection
因此接受的属性,不是吗?
如何让它与 url rewrite 模块一起使用?如果它不能工作,那么我必须问:如果它所能做的只是appSettings
和,那有什么意义connectionStrings
呢?我知道您可以为自己的自定义部分创建自定义部分处理程序。问题是这不是一个自定义部分——它是微软制作的一个高度使用的模块,几乎所有在 IIS 上运行网站的人都在使用它!
- - 编辑 - -
从那以后,我发现该<rewrite>
元素也是 aconfigSectionGroup
但所有子元素都是configSection
,所以它应该在理论上起作用。我找到了这个链接:
https://githubmemory.com/repo/aspnet/MicrosoftConfigurationBuilders/issues/149
一个人正在为一个似乎sectionHandler
有效的知名部分创建自己的部分。<customErrors>
我相信它会指示 configBuilders 处理该部分,否则它会忽略它。
该类声明如下:
注意CustomErrorsSection
is inSystem.Web.Configuration
和 is public sealed
。
我试图通过创建一个来复制它,sectionHandler<Microsoft.Web.Management.Iis.Rewrite.ProvidersSection>
但它是internal sealed
不可能实现的。
这真的不可能吗??