gpt4 book ai didi

orchardcms - Orchard CMS 模块 web.config

转载 作者:行者123 更新时间:2023-12-03 16:50:24 25 4
gpt4 key购买 nike

我有一个现有的 MVC 3 Web 应用程序,我将它作为 Orchard CMS 中的一个模块运行。我的 Web 应用程序的主要 web.config 有一大堆 appSettings、connectionStrings、system.serviceModel 和其他各种部分。

在我看来,这些设置中的大部分(如果不是全部)都被忽略了。

显然,一种解决方案是使用我的设置更新 Orchard.Web web.config,但我不希望尽可能自定义此 web.config,以便将来轻松升级。

在我的 Orchard 模块 MVC 应用程序中使用我自己的 web.config 是否有任何其他推荐的方法/最佳实践?

干杯。

最佳答案

我在这里找到了答案:http://blog.wouldbetheologian.com/2012/09/loading-module-specific-connection.html

// Read the connection string from the *local* web.config (not the root).
var fileMap = new ExeConfigurationFileMap();
fileMap.ExeConfigFilename = HttpContext.Current.Server.MapPath("~/Modules/Alanta.Web.Corp/web.config");
var configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
_connectionString = configuration.ConnectionStrings.ConnectionStrings["AlantaEntities"].ConnectionString;

关于orchardcms - Orchard CMS 模块 web.config,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8535911/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com