title: NHibernate - Unrecognized configuration section hibernate-configuration
body: <p>I have the following configuration file in a application console:</p>
  
  <pre><code>    &lt;?xml version="1.0"?&gt;
  &lt;configuration&gt;
  &lt;configSections&gt;
      &lt;sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" &gt;
        &lt;section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/&gt;
        &lt;section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"/&gt;  
        &lt;section name="ConsoleApplication1.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /&gt;
      &lt;/sectionGroup&gt;
  &lt;/configSections&gt; 
  &lt;startup&gt;&lt;supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/&gt;&lt;/startup&gt;&lt;applicationSettings&gt;
          &lt;ConsoleApplication1.Properties.Settings&gt;
              &lt;setting name="AppName" serializeAs="String"&gt;
                  &lt;value&gt;Simple Application&lt;/value&gt;
              &lt;/setting&gt;
  
          &lt;/ConsoleApplication1.Properties.Settings&gt;
      &lt;/applicationSettings&gt;
    &lt;hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"&gt;
      &lt;session-factory name="NHibernate.Test"&gt;
        &lt;property name="connection.driver_class"&gt;
          NHibernate.Driver.SqlClientDriver
        &lt;/property&gt;
        &lt;property name="connection.connection_string"&gt;
          Data Source=.\SQLEXPRESS;Initial Catalog=TravelAssistant;Integrated Security=True
        &lt;/property&gt;
        &lt;property name="adonet.batch_size"&gt;10&lt;/property&gt;
        &lt;property name="show_sql"&gt;true&lt;/property&gt;
        &lt;property name="dialect"&gt;NHibernate.Dialect.MsSql2005Dialect&lt;/property&gt;
        &lt;property name="use_outer_join"&gt;true&lt;/property&gt;
        &lt;property name="command_timeout"&gt;60&lt;/property&gt;
        &lt;property name="query.substitutions"&gt;true 1, false 0, yes 'Y', no 'N'&lt;/property&gt;
        &lt;property name="proxyfactory.factory_class"&gt;
          NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu
        &lt;/property&gt;
      &lt;/session-factory&gt;
    &lt;/hibernate-configuration&gt;
  
  &lt;/configuration&gt;
  </code></pre>
  
  <p>The nhibernate section I haved copied from an dummy application (console application) where it worked just fine. When I run my app (a slightly bigger one with more class library projects involved and referenced) I get the following exception:</p>
  
  <pre><code>System.Configuration.ConfigurationErrorsException was unhandled
    Message=Configuration system failed to initialize
    Source=System.Configuration
    BareMessage=Configuration system failed to initialize
    Line=0
    StackTrace:
         at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
         at System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(String sectionName)
         at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.RefreshConfig(String sectionName)
         at System.Configuration.ConfigurationManager.RefreshSection(String sectionName)
         at System.Configuration.ClientSettingsStore.ReadSettings(String sectionName, Boolean isUserScoped)
         at System.Configuration.LocalFileSettingsProvider.GetPropertyValues(SettingsContext context, SettingsPropertyCollection properties)
         at System.Configuration.SettingsBase.GetPropertiesFromProvider(SettingsProvider provider)
         at System.Configuration.SettingsBase.GetPropertyValueByName(String propertyName)
         at System.Configuration.SettingsBase.get_Item(String propertyName)
         at System.Configuration.ApplicationSettingsBase.GetPropertyValue(String propertyName)
         at System.Configuration.ApplicationSettingsBase.get_Item(String propertyName)
         at TravelAssistant.OnlineAPIs.Properties.Settings.get_HotelsAllStarsURL() in C:\Users\Tamas_Ionut\Documents\Visual Studio 2010\Projects\TravelAssistant\TravelAssistant.OnlineAPIs\Properties\Settings.Designer.cs:line 49
         at TravelAssistant.OnlineAPIs.Implementations.CoreModels.Lodging.HotelLodgingProvider.ConstructURL(Location location, Decimal lowPrice, Decimal highPrice, List`1 numberOfStars, Int32 lowCustomerRating, Int32 highCustomerRating, DateTime checkIn, DateTime checkOut, Int32 numberOfAdults) in C:\Users\Tamas_Ionut\Documents\Visual Studio 2010\Projects\TravelAssistant\TravelAssistant.OnlineAPIs\Implementations\CoreModels\Lodging\HotelLodgingProvider.cs:line 77
         at TravelAssistant.OnlineAPIs.Implementations.CoreModels.Lodging.HotelLodgingProvider.RetrieveHotels(Location location, Decimal lowPrice, Decimal highPrice, List`1 numberOfStars, Int32 lowCustomerRating, Int32 highCustomerRating, DateTime checkIn, DateTime checkOut, Int32 numberOfAdults) in C:\Users\Tamas_Ionut\Documents\Visual Studio 2010\Projects\TravelAssistant\TravelAssistant.OnlineAPIs\Implementations\CoreModels\Lodging\HotelLodgingProvider.cs:line 148
         at ConsoleApplication1.Program.Main(String[] args) in C:\Users\Tamas_Ionut\Documents\Visual Studio 2010\Projects\TravelAssistant\ConsoleApplication1\Program.cs:line 23
         at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
         at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
         at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
         at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
         at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
         at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
         at System.Threading.ThreadHelper.ThreadStart()
    InnerException: System.Configuration.ConfigurationErrorsException
         Message=Unrecognized configuration section hibernate-configuration. (C:\Users\Tamas_Ionut\Documents\Visual Studio 2010\Projects\TravelAssistant\ConsoleApplication1\bin\Debug\ConsoleApplication1.vshost.exe.Config line 18)
         Source=System.Configuration
         BareMessage=Unrecognized configuration section hibernate-configuration.
         Filename=C:\Users\Tamas_Ionut\Documents\Visual Studio 2010\Projects\TravelAssistant\ConsoleApplication1\bin\Debug\ConsoleApplication1.vshost.exe.Config
         Line=18
         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)
         InnerException: 
  </code></pre>
  
  <p>The dummy app where I haved tested the same Db connection with hibernate worked just fine.
  If I remove the nhibernate section the rest of the app runs just fine.
  Could someone give me a hint where is the issue? (the nhibernate versions are corect)</p>
  
  <p>Thanks,
  Tamas</p>