2011-06-16 9 views
9

başlatılamadı. App.config biçimi nerede yanlış?Yapılandırma Sistemi Benim uygulamada

<?xml version="1.0"?> 
    <configuration> 


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



     <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> 




     <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> 
+0

Örneğinizde açılışta "" etiketi yok, ancak belki de kopyalanmadı mı? –

+0

Evet, kopyalanmadı. –

cevap

24

deneyin configSections

Yani yapılandırma dosyası aşağıdaki gibi devam eder yapılandırmaları ilk öğesi olmalıdır, çünkü configuration ilk alt öğesi olarak configSections koyarak:

<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> 
+0

Tereyağlı sıcak bir bıçak gibi çalışır! –

+0

:) Yardım edebileceğime sevindim .. – Sumit

+0

2 yıl ve çözümünüz hala çalışıyor. Teşekkürler! – andrewb

1

budur Biraz geç biliyorum ama bunu kaldırdığım zaman:

sonra hata kaybolur.

+1

İlk alt öğe olarak configSections uygulamanızın olması gerekir: "configSections öğesi bir yapılandırma dosyasındaysa, configSections öğesi yapılandırma öğesinin ilk alt öğesi olmalıdır." Bu yapılandırma öğesini aşağı taşırsanız çalışır. – Thomas

0

Bu benim için çalışır. Projenizin hedef Çerçeve özelliği istemci profili

olmadığını ile App.Config veya web.config başlar bundan sonra <configuration> sekme ör

<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> 

<configSections> etiketi emin olun emin olun