How to enable WCF traces programmatically? -
is there way enable/disable wcf trace/logging perticular end point without changing web.config ?
you first need access trace object name, defined in .config file. example:
tracesource ts = new tracesource("system.servicemodel");
then can set filter level all, none or in between:
ts.switch.level = sourcelevels.off; // nothing ts.switch.level = sourcelevels.all; // ts.switch.level = sourcelevels.warning; //warning or higher
btw - tracesource
class in system.diagnostics
namespace, don't forget appropriate using
statement.
Comments
Post a Comment