WCF Library hosted in a Windows Service with Message Logging turned on works until it is turned off by loading Exchange Admin snapin RRS feed

  • Question

  • We have a WCF library hosted in a Windows Service.  The hosting config file is set to turn on Message logging and this is working as documented.  The Windows Application Log indicates that "Message Logging has been turned on.", event ID: 8, Source: System.ServiceModel  However, when one of the services loads the following powershell snapin, message logging is turned off.  The problem line of code and snapin is as follows:

    ps.Runspace.RunspaceConfiguration.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.E2010", out warning);

    Loading this Exchange Management Administration Snapin has the side effect of turning off logging of WCF Messages.  Immediately after the above snapin is loaded the following Event is logged to the Windows App log:

    'Message logging has been turned off.', Event ID: 9, Source: System.ServiceModel

    That is really not very nice since we would like to load this Snapin and log the WCF messages.  I don't see any doc on how to turn it back on in the code.

    Any ideas on how to prevent loading of this plugin from turning off WCF message logging or on how to turn it back on from code after loading the Exchange snapin?


    Monday, April 9, 2012 1:36 PM