2017-06-06 2 views
0

Ich entwickle eine Windows-Formularanwendung mit VB. Meine Software verbindet sich mit einer SQL-Datenbank und einer Google Adwords API. Das Problem ist, wenn ich versuche, die Schlüssel für die Adwords Api in der App.config-Datei hinzufügen Ich erhalte den folgenden Fehler: "Konfiguration System konnte nicht initialisiert werden: AdWordsApi Konfigurationsabschnitt nicht erkannt". Ich habe einige Beispiele über Hoy gelesen, um meine Appconfig-Datei zu füllen, aber nichts scheint zu funktionieren. Können Sie mir helfen, den richtigen Weg zu kennen? Ich lasse hier meine App.configHinzufügen von AdWordsApi-Schlüsseln zu App.config

<?xml version="1.0"?> 
<configuration> 
    <configSections> 
     <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXXX"> 
      <section name="ReporteExcel.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXX" requirePermission="false"/> 
     </sectionGroup> 
    </configSections> 

    <AdWordsApi> 
     <add key="MaskCredentials" value="true"/> 
     <add key="EnableSoapExtension" value="true"/> 
     <add key="EnableGzipCompression" value="true"/> 
     <add key="IncludeUtilitiesInUserAgent" value="true"/> 
     <add key="ProxyServer" value=""/> 
     <add key="ProxyUser" value=""/> 
     <add key="ProxyPassword" value=""/> 
     <add key="ProxyDomain" value=""/> 
     <add key="DeveloperToken" value="XXXXXXXXXXXXXXXXX"/> 
     <add key="GeneralClientCustomerId" value="XXX-XXX-XXXX"/> 
     <add key="CanalDigitalClientCustomerId" value="XXX-XXX-XXXX"/> 
     <add key="BanamexClientCustomerId" value="XXX-XXX-XXXX"/> 
     <add key="AuthorizationMethod" value="OAuth2"/> 
     <add key="OAuth2ClientId" value="XXXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXX.apps.googleusercontent.com"/> 
     <add key="OAuth2ClientSecret" value="XXXXXXXXXXXXXX-XXXXXXX"/> 
     <add key="OAuth2RefreshToken" value="1/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXXX-X"/> 
     <add key="WebClientCustomerId" value="XXX-XXX-XXXX"/> 
     <add key="SkipReportHeader" value="true"/> 
     <add key="SkipReportSummary" value="true"/> 
     <add key="SkipColumnHeader" value="false"/> 
    </AdWordsApi> 
    <startup> 
     <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> 
    </startup> 
    <applicationSettings> 
     <ReporteExcel.My.MySettings> 
      <setting name="sqlConnectionStr" serializeAs="String"> 
       <value>Data Source=192.168.2.1;Initial Catalog=CATALOG;User ID=ADMIN;Password=ADMIN;</value> 
      </setting> 
     </ReporteExcel.My.MySettings> 
    </applicationSettings> 
    <runtime> 
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
      <dependentAssembly> 
       <assemblyIdentity name="Google.AdWords" publicKeyToken="XXXXXXXXXXX" culture="neutral"/> 
       <bindingRedirect oldVersion="18.33.0.0" newVersion="18.34.0.0"/> 
      </dependentAssembly> 
      <dependentAssembly> 
       <assemblyIdentity name="Google.Ads.Common" publicKeyToken="XXXXXXXXXXXXXX" culture="neutral"/> 
       <bindingRedirect oldVersion="3.17.0.0" newVersion="3.18.0.0"/> 
      </dependentAssembly> 
     </assemblyBinding> 
    </runtime> 
</configuration> 

Antwort

0

Datei, wie sie die Datei liest, wirken die configSections als Inhaltsverzeichnis für die Datei folgende Änderung Versuchen und sehen, ob es erkannt werden kann. taken from here

<configSections> 
      <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXXX"> 
       <section name="ReporteExcel.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXX" requirePermission="false"/> 
      </sectionGroup> 
      <section name="AdWordsApi" type="System.Configuration.DictionarySectionHandler"/>  
</configSections> 
+1

Die Zeile, die Sie nicht genau angegeben funktionierte, aber sie hatten recht, weil ich den „Abschnitt“ Spezifikation, um die Konfigurationsdatei die Tag zu erkennen, fehlte. Ich habe die folgende Zeile verwendet '' –

+0

Ausgezeichnet, und ich habe die Antwort auf diesen Typ zu korrigieren! –

Verwandte Themen