views:

103

answers:

1

{"Configuration system failed to initialize"}

i get this error while trying to run a windows application i made ,which means that castle windsor couldnt initialize the configuration from the app.config

the funny thing is my test project works and its able to initialize the same app.config but when i moved that to windows application and used the same code it failed !

any help would be appreciated,

thanks in advance


Configuration Code:

  <configSections>
<section
    name="castle"
    type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler, Castle.Windsor" /></configSections>

  <castle>
<components>
  <component id="UserRepository"
             service="Abstract.IDAO`2[[BusniessEntities.User,BusniessEntities],[System.Int32]],Abstract"
             type="Concrete.SqlUserRepository,Concrete"/>
</components>

this is the C# code:

WindsorContainer _container = new WindsorContainer(new XmlInterpreter(new ConfigResource("castle")));

same code work in test project. but doesnt in windows application.

A: 

i got it solved

 <configuration><startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>  </startup>  <configSections><section
    name="castle"        type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler,Castle.Windsor" /></configSections>
  <castle>
<components>
  <component id="UserRepository"
             service="Abstract.IDAO`2[[BusniessEntities.User,BusniessEntities],[System.Int32]],Abstract"
             type="Concrete.SqlUserRepository,Concrete"/>
</components>

config section had to be before anything else , in test project the app.config didnt have startup tag that is why it worked but in windows application app.config have startup tag so configsection had to be moved up

Stacker