製品の RELEASE ビルドがインストールされている場合に、クライアントへの障害情報のフローを自動的に無効にするコードがあります。RELEASE ビルドで MEX メタデータを使用できないようにする賢い方法があるかどうか疑問に思っています。これは、次のリンクで見つけた障害情報を自動的に無効にするために行ったことです: 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