当安装了我们产品的 RELEASE 版本时,我的代码会自动阻止故障信息流向客户端。我想知道是否有一种聪明的方法可以让 MEX 元数据在我们的 RELEASE 版本中不可用。这是我为自动禁用故障信息所做的工作,我在以下链接中找到了这些信息: http: //codeidol.com/csharp/wcf/Faults/Fault-Contracts/。
// Enables exceptions to flow to clients when built for debugging;
// Otherwise, no details go to client.
public static class DebugHelper
{
public const bool IncludeExceptionDetailInFaults =
#if DEBUG
true;
#else
false;
#endif
}
// This service is singleton. If other calls arrive while one is in progress,
// they are queued.
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single,
ConcurrencyMode = ConcurrencyMode.Single,
IncludeExceptionDetailInFaults = DebugHelper.IncludeExceptionDetailInFaults)]
public class OurService : IOurService