2011-12-16 3 views
3

기존 MVC 3 웹 응용 프로그램이 있으며 Orchard CMS 내부에서 모듈로 실행하고 있습니다. 웹 응용 프로그램의 주요 web.config에는 appSettings, connectionStrings, system.serviceModel 및 기타 다양한 섹션이 있습니다.과수원 CMS 모듈 web.config

이 설정 중 대부분 (전부는 아닐지라도)이 무시되는 것처럼 보입니다.

한 가지 해결책은 분명히 Orchard.Web web.config를 내 설정으로 업데이트하는 것이지만 앞으로는 쉽게 업그레이드 할 수 있도록 가능한 한이 web.config를 사용자 지정하지 않는 것이 좋습니다.

Orchard 모듈 MVC 응용 프로그램에서 내 web.config를 사용하기위한 다른 권장 방법/모범 사례가 있습니까?

건배.

답변

0

예, web.config의 문제점은 임차인을 인식하지 못한다는 것입니다. Orchard에서 설정을 처리하는 권장 방법은 파트를 사이트 콘텐츠 유형에 추가하는 것입니다. 코드 전체에 걸쳐 몇 가지 예가 있습니다.

이 몇 가지 추가 정보를 제공해야합니다 : http://docs.orchardproject.net/Documentation/Adding-custom-settings

4

내가 여기에 대한 답을 발견 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;