本文整理汇总了C#中MessageFault类的典型用法代码示例。如果您正苦于以下问题:C# MessageFault类的具体用法?C# MessageFault怎么用?C# MessageFault使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MessageFault类属于命名空间,在下文中一共展示了MessageFault类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryCreateException
public bool TryCreateException(Message message, MessageFault fault, out Exception exception)
{
if (message == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("message");
}
if (fault == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("fault");
}
bool created = this.OnTryCreateException(message, fault, out exception);
if (created)
{
if (exception == null)
{
string text = SR.Format(SR.FaultConverterDidNotCreateException, this.GetType().Name);
Exception error = new InvalidOperationException(text);
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(error);
}
}
else
{
if (exception != null)
{
string text = SR.Format(SR.FaultConverterCreatedException, this.GetType().Name);
Exception error = new InvalidOperationException(text, exception);
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(error);
}
}
return created;
}
示例2: OnTryCreateException
protected override bool OnTryCreateException (
Message message, MessageFault fault, out Exception error)
{
if (message == null)
throw new ArgumentNullException ("message");
if (fault == null)
throw new ArgumentNullException ("fault");
error = null;
FaultCode fc;
if (version.Envelope.Equals (EnvelopeVersion.Soap11))
fc = fault.Code;
else
fc = fault.Code.SubCode;
if (fc == null)
return false;
string msg = fault.Reason.GetMatchingTranslation ().Text;
if (fc.Namespace == message.Version.Addressing.Namespace) {
switch (fc.Name) {
case "ActionNotSupported":
error = new ActionNotSupportedException (msg);
return true;
case "DestinationUnreachable":
error = new EndpointNotFoundException (msg);
return true;
}
}
return false;
}
示例3: CreateLogbookentry
private static LogData CreateLogbookentry(Exception error, MessageFault fault)
{
string typeName, methodName;
string assemblyName = typeName = methodName = "Unknown";
if (error.TargetSite != null)
{
assemblyName = error.TargetSite.Module.Assembly.GetName().Name;
methodName = error.TargetSite.Name;
if (error.TargetSite.DeclaringType != null) typeName = error.TargetSite.DeclaringType.Name;
}
string fileName = GetFileName(error);
int lineNumber = GetLineNumber(error);
string exceptionName = error.GetType().ToString();
string exceptionMessage = error.Message;
string providedFault = String.Empty;
string providedMessage = String.Empty;
if (fault != null)
{
providedFault = (fault.Code == null) ? "Unknown" : fault.Code.Name;
providedMessage = (fault.Reason == null || fault.Reason.Translations == null ||
fault.Reason.Translations.Count <= 0)
? "Unknown"
: fault.Reason.Translations[0].Text;
}
return new LogData(assemblyName, fileName, lineNumber, typeName, methodName, exceptionName, exceptionMessage,
providedFault, providedMessage);
}
示例4: XmlRpcMessage
public XmlRpcMessage(MessageFault fault)
: this()
{
isFault = true;
bodyReader = XmlRpcDataContractSerializationHelper.CreateFaultReader(fault);
bodyReader.MoveToContent();
}
示例5: TryCreateException
public bool TryCreateException(Message message, MessageFault fault, out Exception exception)
{
if (message == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("message");
}
if (fault == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("fault");
}
bool flag = this.OnTryCreateException(message, fault, out exception);
if (flag)
{
if (exception == null)
{
Exception exception2 = new InvalidOperationException(System.ServiceModel.SR.GetString("FaultConverterDidNotCreateException", new object[] { base.GetType().Name }));
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(exception2);
}
return flag;
}
if (exception != null)
{
Exception exception3 = new InvalidOperationException(System.ServiceModel.SR.GetString("FaultConverterCreatedException", new object[] { base.GetType().Name }), exception);
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(exception3);
}
return flag;
}
示例6: FaultException
protected FaultException(SerializationInfo info, StreamingContext context) : base(info, context)
{
this.code = this.ReconstructFaultCode(info, "code");
this.reason = this.ReconstructFaultReason(info, "reason");
this.fault = (MessageFault) info.GetValue("messageFault", typeof(MessageFault));
this.action = info.GetString("action");
}
示例7: AreMessageFaultEqual
static void AreMessageFaultEqual (MessageFault a, MessageFault b, string label)
{
Assert.AreEqual (a.Actor, b.Actor, label + ".Actor");
Assert.AreEqual (a.Code, b.Code, label + ".Code");
Assert.AreEqual (a.HasDetail, b.HasDetail, label + ".HasDetail");
Assert.AreEqual (a.Node, b.Node, label + ".Node");
Assert.AreEqual (a.Reason, b.Reason, label + ".Reason");
}
示例8: SdmxMessageFault
public SdmxMessageFault(MessageFault messageFault, string nameSpace)
{
if (messageFault == null)
{
throw new ArgumentNullException("messageFault");
}
this._messageFault = messageFault;
this._nameSpace = nameSpace;
}
示例9: FaultException
public FaultException (MessageFault fault, string action)
{
if (fault == null)
throw new ArgumentNullException ("fault");
//if (action == null)
// throw new ArgumentNullException ("action");
this.fault = fault;
this.action = action;
}
示例10: Fault
public void Fault(Message message, MessageFault fault)
{
if (this.CheckMessage(message, false) != null)
{
this.state.Perf.FaultsReceivedCountPerInterval.Increment();
}
if (DebugTrace.Info)
{
DebugTrace.Trace(TraceLevel.Info, "Ignoring {0} fault from completion participant at {1}: {2}", Library.GetFaultCodeName(fault), Ports.TryGetFromAddress(message), Library.GetFaultCodeReason(fault));
}
}
示例11: LogError
public static void LogError(Exception error, MessageFault fault)
{
string message = CreateLogbookentry(error, fault).ToString();
if (error is SemanticException)
{
s_Logger.Debug(message, error);
}
else
{
s_Logger.Error(message, error);
}
}
示例12: LogError
public static void LogError(Exception error,MessageFault fault)
{
LogbookEntryClient entry = CreateLogbookEntry(error,fault);
try
{
LogbookManagerClient proxy = new LogbookManagerClient();
proxy.LogEntry(entry);
proxy.Close();
}
catch
{}
}
示例13: GetBaseFaultCode
public static FaultCode GetBaseFaultCode(MessageFault fault)
{
FaultCode subCode = fault.Code;
if (subCode != null)
{
while (subCode.SubCode != null)
{
subCode = subCode.SubCode;
}
}
return subCode;
}
示例14: OnTryCreateException
protected override bool OnTryCreateException(Message message, MessageFault fault, out Exception exception)
{
if (this.innerChannel == null)
{
exception = null;
return false;
}
FaultConverter property = this.innerChannel.GetProperty<FaultConverter>();
if (property != null)
{
return property.TryCreateException(message, fault, out exception);
}
exception = null;
return false;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:15,代码来源:SecurityChannelFaultConverter.cs
示例15: GetFaultCodeName
public static string GetFaultCodeName(MessageFault fault)
{
FaultCode subCode = fault.Code;
if (subCode == null)
{
return "unknown";
}
if (subCode.SubCode != null)
{
subCode = subCode.SubCode;
if (subCode == null)
{
return "unknown";
}
}
return subCode.Name;
}