title: WCF Service enable tracing
body: <p>After two days of try and error and blind debugging, my web service still produces some error in certain cases and for now, I don't know why.
  Therefor, I would like to enable tracing for the service in order to have at least a little feedback.</p>
  
  <p>However, I tried a few addition to the web.config, but none ever produced a trace file, even if the service responded with an error.</p>
  
  <p>So long, this is my web.config:</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
      &lt;configuration&gt;
      &lt;configSections&gt;
      &lt;section name="entityFramework"        type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /&gt;
       &lt;/configSections&gt;
       &lt;connectionStrings&gt;
       &lt;...removed here... /&gt;
       &lt;/connectionStrings&gt;
      &lt;appSettings&gt;
      &lt;add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" /&gt;
      &lt;/appSettings&gt;
      &lt;system.web&gt;
      &lt;customErrors mode="Off"&gt;&lt;/customErrors&gt;
      &lt;compilation targetFramework="4.5.1" /&gt;
      &lt;httpRuntime targetFramework="4.5.1" /&gt;
      &lt;/system.web&gt;
      &lt;system.serviceModel&gt;
      &lt;services&gt;
        &lt;service name="TimeRecHomePage.Service.TimeService" behaviorConfiguration="TimeServiceBehavior"&gt;
          &lt;endpoint name="webHttpBinding" address="" binding="webHttpBinding" bindingConfiguration="webHttpTransportSecurity" contract="TimeRecHomePage.Service.ITimeService" behaviorConfiguration="webHttp" /&gt;
          &lt;endpoint name="mexHttpBinding" address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" /&gt;
        &lt;/service&gt;
        &lt;/services&gt;
        &lt;bindings&gt;
        &lt;webHttpBinding&gt;
          &lt;binding name="webHttpTransportSecurity"&gt;
            &lt;security mode="Transport" /&gt;
          &lt;/binding&gt;
        &lt;/webHttpBinding&gt;
      &lt;/bindings&gt;
      &lt;behaviors&gt;
        &lt;serviceBehaviors&gt;
          &lt;behavior name="TimeServiceBehavior"&gt;
            &lt;serviceMetadata httpsGetEnabled="true" /&gt;
            &lt;serviceDebug includeExceptionDetailInFaults="false" /&gt;
          &lt;/behavior&gt;
          &lt;behavior&gt;
            &lt;serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" /&gt;
            &lt;serviceDebug includeExceptionDetailInFaults="true" /&gt;
          &lt;/behavior&gt;
        &lt;/serviceBehaviors&gt;
        &lt;endpointBehaviors&gt;
          &lt;behavior name="webHttp"&gt;
            &lt;webHttp defaultOutgoingResponseFormat="Json" automaticFormatSelectionEnabled="true" defaultBodyStyle="WrappedRequest" /&gt;
          &lt;/behavior&gt;
        &lt;/endpointBehaviors&gt;
      &lt;/behaviors&gt;
      &lt;protocolMapping&gt;
        &lt;add binding="basicHttpsBinding" scheme="https" /&gt;
      &lt;/protocolMapping&gt;
      &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /&gt;
    &lt;/system.serviceModel&gt;
    &lt;system.webServer&gt;
      &lt;modules runAllManagedModulesForAllRequests="true" /&gt;
      &lt;directoryBrowse enabled="false" /&gt;
    &lt;/system.webServer&gt;
    &lt;entityFramework&gt;
      &lt;defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"&gt;
        &lt;parameters&gt;
          &lt;parameter value="v13.0" /&gt;
        &lt;/parameters&gt;
      &lt;/defaultConnectionFactory&gt;
      &lt;providers&gt;
        &lt;provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /&gt;
      &lt;/providers&gt;
    &lt;/entityFramework&gt;
    &lt;runtime&gt;
      &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-5.1.0.0" newVersion="5.1.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;/assemblyBinding&gt;
       &lt;/runtime&gt;
       &lt;/configuration&gt;
  </code></pre>
  
  <p>I already looked up the configuration of the tracing and tested the entries for the web.config proposed e.g.<a href="https://stackoverflow.com/questions/4773026/how-to-debug-wcf-service-call-works-in-vs-but-not-in-iis" title="here">here</a>, <a href="https://stackoverflow.com/questions/4271517/how-to-turn-on-wcf-tracing" title="here">here</a> and also read the <a href="https://msdn.microsoft.com/de-de/library/ms733025(v=vs.110).aspx" rel="nofollow noreferrer">documentation</a>. </p>
  
  <p>As it is written in the documentation, that from Windows 8 on, you need privileged rights in order to trace, I also changed the application pool identity, without success though (the service runs on an Win 2012 R2 server).</p>
  
  <p>What am I missing in order to enable and use tracing?
  Thank you in advance for your efforts!</p>