2016-06-23 8 views
3

Ich habe folgende Konfiguration. Wenn ich versuche, meine Anwendung immer folgende Fehler zu starten:Der Typinitialisierer für 'System.ServiceModel.Diagnostics.TraceUtility' hat eine Ausnahme ausgelöst

Die Typeninitialisierer für ‚System.ServiceModel.Diagnostics.TraceUtility‘

eine Ausnahme warf
<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <system.serviceModel> 
     <bindings> 
      <basicHttpBinding> 
       <binding name="BasicHttpBinding_InterFaceName" maxReceivedMessageSize="2147483647"> 
        <security mode="TransportWithMessageCredential" /> 
       </binding> 
       <binding name="BasicHttpBinding_IEventSubscriptionCallback"> 
        <security mode="TransportWithMessageCredential" /> 
       </binding> 
       <binding name="BasicHttpBinding_IFolders"> 
        <security mode="TransportWithMessageCredential" /> 
       </binding> 
       <binding name="BasicHttpBinding_IBrowse"> 
        <security mode="TransportWithMessageCredential" /> 
       </binding> 
       <binding name="BasicHttpBinding_IConfig"> 
        <security mode="TransportWithMessageCredential" /> 
       </binding> 
       <binding name="BasicHttpBinding_IData"> 
        <security mode="TransportWithMessageCredential" /> 
       </binding> 
       <binding name="BasicHttpBinding_IDataAccess"> 
        <security mode="TransportWithMessageCredential" /> 
       </binding> 
       <binding name="BasicHttpBinding_IMetadata"> 
        <security mode="TransportWithMessageCredential" /> 
       </binding> 
       <binding name="BasicHttpBinding_IServiceControl"> 
        <security mode="TransportWithMessageCredential" /> 
       </binding> 
      </basicHttpBinding> 
     </bindings> 
     <client> 
      <endpoint address="https://EndPointAddress/InterFaceName" 
       binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_InterFaceName" 
       contract="ClientNameBF.InterFaceName" name="BasicHttpBinding_InterFaceName" /> 
      <endpoint address="https://EndPointAddress/IEventSubscriptionCallback" 
       binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IEventSubscriptionCallback" 
       contract="ClientNameBF.IEventSubscriptionCallback" name="BasicHttpBinding_IEventSubscriptionCallback" /> 
      <endpoint address="https://EndPointAddress/IFolders" 
       binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFolders" 
       contract="ClientNameBF.IFolders" name="BasicHttpBinding_IFolders" /> 
      <endpoint address="https://EndPointAddress/IBrowse" 
       binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IBrowse" 
       contract="ClientNameBF.IBrowse" name="BasicHttpBinding_IBrowse" /> 
      <endpoint address="https://EndPointAddress/IConfig" 
       binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IConfig" 
       contract="ClientNameBF.IConfig" name="BasicHttpBinding_IConfig" /> 
      <endpoint address="https://EndPointAddress/IData" 
       binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IData" 
       contract="ClientNameBF.IData" name="BasicHttpBinding_IData" /> 
      <endpoint address="https://EndPointAddress/IDataAccess" 
       binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IDataAccess" 
       contract="ClientNameBF.IDataAccess" name="BasicHttpBinding_IDataAccess" /> 
      <endpoint address="https://EndPointAddress/IMetadata" 
       binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMetadata" 
       contract="ClientNameBF.IMetadata" name="BasicHttpBinding_IMetadata" /> 
      <endpoint address="https://EndPointAddress/IServiceControl" 
       binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IServiceControl" 
       contract="ClientNameBF.IServiceControl" name="BasicHttpBinding_IServiceControl" /> 
     </client> 
    </system.serviceModel> 
    <applicationSettings> 
    <PKISettings> 
     <setting name="CertThumbPrint" serializeAs="String"> 
     <value>Something</value> 
     </setting> 
    </PKISettings> 
    <UserSettings> 
     <setting name="User1" serializeAs="String"> 
     <value>Users</value> 
     </setting> 
     <setting name="Pass1" serializeAs="String"> 
     <value>JT1yn4Y9SG</value> 
     </setting> 
     <setting name="User2" serializeAs="String"> 
     <value>Smthings</value> 
     </setting> 
     <setting name="Pass2" serializeAs="String"> 
     <value>sndkjhjsf</value> 
     </setting> 
     <setting name="User3" serializeAs="String"> 
     <value>Usr</value> 
     </setting> 
     <setting name="Pass3" serializeAs="String"> 
     <value>dgfg/ndfgdfg</value> 
     </setting> 
     <setting name="User4" serializeAs="String"> 
     <value>dfgfgdgf</value> 
     </setting> 
     <setting name="Pass4" serializeAs="String"> 
     <value>dsfgfg=</value> 
     </setting> 
    </UserSettings> 
    </applicationSettings> 
</configuration> 
+0

Wo Sie 'angegeben haben serviceBehaviors' –

+0

Ich habe nicht den ServiceBehaviours definiert, funktioniert dies ohne Anwendungseinstellungen in Ordnung, aber nicht mit den Einstellungen Anwendungsabschnitt – Simsons

+0

Haben Sie habe 'innereException' für diesen Fehler? –

Antwort

3

Sie configSections aus Ihrer Konfiguration fehlt (völlig unabhängig von WCF). Zum Beispiel (muss das erste Kind unter configuration Elemente sein):

<configuration> 
    <configSections> 
     <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > 
      <section name="PKISettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 
      <section name="UserSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 
     </sectionGroup> 
    </configSections>