Configuration System Failed To Initialize

爱⌒轻易说出口 提交于 2019-12-05 00:54:32
Sumit

Try putting the configSections as the first child element of configuration, because configSections should be the first element of configurations

So your config file will go like this:

<configuration>

  <configSections>
    <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <section name="Vegi_Manager.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
    </sectionGroup>
  </configSections>

  <connectionStrings>
    <add name="ConStr" connectionString="Integrated Security=false;Persist Security Info=False;User ID=funny;password=veryfunny;Initial Catalog=vegimanager;Data Source=.\sqlexpress;"/>
  </connectionStrings>

  <userSettings>
    <Vegi_Manager.Properties.Settings>
      <setting name="FIRMNAME" serializeAs="String">
        <value/>
      </setting>
      <setting name="FIRMADDRESS" serializeAs="String">
        <value/>
      </setting>
      <setting name="FIRMCITY" serializeAs="String">
        <value/>
      </setting>
      <setting name="FIRMSTATE" serializeAs="String">
        <value/>
      </setting>
      <setting name="FIRMPHONE" serializeAs="String">
        <value/>
      </setting>
      <setting name="FIRMMOBILE" serializeAs="String">
        <value/>
      </setting>
      <setting name="FIRMEMAIL" serializeAs="String">
        <value/>
      </setting>
      <setting name="FIRMTIN" serializeAs="String">
        <value/>
      </setting>
      <setting name="FIRMPAN" serializeAs="String">
        <value/>
      </setting>
      <setting name="FIRMMANDITAXNO" serializeAs="String">
        <value/>
      </setting>
      <setting name="INITIALFONFIGDONE" serializeAs="String">
        <value>False</value>
      </setting>
      <setting name="FIRMJURISDICTION" serializeAs="String">
        <value/>
      </setting>
      <setting name="FIRMBANKDETAILS" serializeAs="String">
        <value/>
      </setting>
      <setting name="FIRMDETAILS" serializeAs="String">
        <value/>
      </setting>
      <setting name="BILLFORMATNO" serializeAs="String">
        <value>0</value>
      </setting>
      <setting name="PRINTERNAME" serializeAs="String">
        <value/>
      </setting>
    </Vegi_Manager.Properties.Settings>
  </userSettings>

  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
</configuration>
Agguro

This is a bit late I know but when I remove this:

<startup>
   <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>

then the error disappears.

ravirajlad

This works for me. Make sure that your app.config or web.config starts with the <configSections> tag inside the <configuration> tab e.g

<configSections>
  <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true"/>
  </configSections>
  <connectionStrings>
<add name="ConStr" connectionString="Integrated Security=false;Persist Security Info=False;User ID=funny;password=veryfunny;Initial Catalog=vegimanager;Data Source=.\sqlexpress;"/>
      </connectionStrings>
  <connectionStrings>

after that make sure that the target Framework property of your project is not client profile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!