2011-03-23 2 views
1

nhibernate를 초기화하려고하면이 오류가 발생합니다..net × 70788 'NHibernate.Cfg.Configuration'의 형식 이니셜 라이저에서 예외가 throw되었습니다.

System.TypeInitializationException was caught 
Message=The type initializer for 'NHibernate.Cfg.Configuration' threw an exception. 
Source=NHibernate 
TypeName=NHibernate.Cfg.Configuration 
StackTrace: 
at NHibernate.Cfg.Configuration..ctor() 
at FluentNHibernate.Cfg.FluentConfiguration..ctor() in D:\_development\fluent-nhibernate\src\FluentNHibernate\Cfg\FluentConfiguration.cs:line 27 
at FluentNHibernate.Cfg.Fluently.Configure() in D:\_development\fluent-nhibernate\src\FluentNHibernate\Cfg\Fluently.cs:line 16 
at Knoema.Application.Model.Repository.Initialize() in C:\Knoema\Knoema.Application.Model\Repository\Repository.cs:line 71 
at ConsoleApplication1.Program.Main(String[] args) in C:\Knoema\ConsoleApplication1\Program.cs:line 19 
InnerException: System.TypeInitializationException 
Message=The type initializer for 'NHibernate.LoggerProvider' threw an exception. 
Source=NHibernate 
TypeName=NHibernate.LoggerProvider 
StackTrace: 
at NHibernate.LoggerProvider.LoggerFor(Type type) 
at NHibernate.Cfg.Configuration..cctor() 
InnerException: System.Configuration.ConfigurationErrorsException 
Message=Configuration system failed to initialize 
Source=System.Configuration 
BareMessage=Configuration system failed to initialize 
Line=0 
StackTrace: 
at System.Configuration.ConfigurationManager.PrepareConfigSystem() 
at System.Configuration.ConfigurationManager.GetSection(String sectionName) 
at System.Configuration.ConfigurationManager.get_AppSettings() 
at NHibernate.LoggerProvider.GetNhibernateLoggerClass() 
at NHibernate.LoggerProvider..cctor() 
InnerException: System.Configuration.ConfigurationErrorsException 
Message=Only one <configSections> element allowed per config file and if present must be the first child of the root <configuration> element. (C:\Knoema\ConsoleApplication1\bin\Debug\ConsoleApplication1.vshost.exe.Config line 10) 
Source=System.Configuration 
BareMessage=Only one <configSections> element allowed per config file and if present must be the first child of the root <configuration> element. 
Filename=C:\Knoema\ConsoleApplication1\bin\Debug\ConsoleApplication1.vshost.exe.Config 
Line=10 
StackTrace: 
at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal) 
at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors) 
at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors() 
at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey) 

답변

2

하나 개의 < configSections> 요소 루트 요소의 첫 번째 자식이어야 설정 파일 당과 현재 경우 허용했다. (C : \ Knoema \의 ConsoleApplication1 \ 빈 \ 디버그 \ ConsoleApplication1.vshost.exe.Config 라인 10)

문제는 사용자가 게시 된 스택 추적에 언급되어있다. 두 개의 항목을 < configSections>으로 입력했거나 설정의 첫 번째 하위 항목이 아닙니다.

관련 문제