2012-04-24 7 views
22

.config 파일을 만들어 web.config에 포함시킬 수 있습니까? 어떻게해야합니까?.config 파일을 만들어 web.config에 포함시킬 수 있습니까?

UPD. 당신은, 예를 들어, 설정 파일을 분리 다음에해야 할 다른 파일에있는 appSettings을 이동하려면 는 : Web.config의에서

myAppSettings.config에서
<appSettings configSource="myAppSettings.config" /> 

:

<appSettings> 
    <add key="ClientValidationEnabled" value="true" /> 
    <add key="UnobtrusiveJavaScriptEnabled" value="true" /> 
    </appSettings> 
+1

이 부분적으로 할 수 있습니까? 일부 설정은 web.config에 속하지만 다른 설정 파일에서는 일부 설정을 의미합니까? –

답변

22

그것은 완전히 명확하지 않다 원하는 모든 작업을 수행 할 수 있지만 모든 구성 섹션을 별도의 파일에 저장하고 configSource 속성을 사용하여 .config 주 파일에서 참조 할 수 있습니다.

자세한 내용은 this 블로그 게시물을 참조하십시오.

+0

정말 고마워요! 이제 모든 것이 제대로 작동합니다. –

17

이 하나 개의 Web.config의 Web.config에서

코드에 여러 CONFIGS을 통합하는 방법은 다음과 같습니다

<appSettings configSource="config\appSettings.config"/> 
<nlog configSource="config\nlog.config"/> 
<applicationSettings> 
     <MyApp.UI.Properties.Settings configSource="config\Settings.APGUI.config"/> 
     <MyApp.BusinessServices.Properties.Settings configSource="config\Settings.Business.config"/> 
     <MyApp.Auditing.Properties.Settings configSource="config\Settings.Auditing.config"/> 
</applicationSettings> 

더 : Managing complex Web.Config files between deployment environments

관련 문제