[英]Split web.config file
我有一个web.config文件,已将其拆分为单独的文件中包含ipSecurity。 此文件按国家保存所有被阻止的IP。 问题是web.security文件仍然很大,我收到此错误
无法读取配置文件,因为它超出了最大文件大小
问题是我可以将web.security文件拆分为多个文件吗? (我在共享主机上,因此无法增加文件限制大小)
以下是配置部分:
<system.webServer>
<security>
<ipSecurity configSource="web.security"></ipSecurity>
</security>
</system.webServer>
我实际上尚未执行此操作,但从理论上讲,您应该能够使用多个配置文件并将其以编程方式添加到当前配置中:
void InitIpSecurityConfig()
{
var pathArray = new[] { "path1", "path2", "pathN" };
foreach (var path in pathArray)
{
var map = new ExeConfigurationFileMap(path);
var config = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationLevel.None);
// manipulate and save to current XML config file
}
}
祝好运!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.