本文整理汇总了C#中MessageFault类的典型用法代码示例。如果您正苦于以下问题:C# MessageFault类的具体用法?C# MessageFault怎么用?C# MessageFault使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MessageFault类属于命名空间,在下文中一共展示了MessageFault类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:SoumikMukherjeeDOTNET,项目名称:wcf,代码行数:34,代码来源:FaultConverter.cs
示例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;
}
开发者ID:Profit0004,项目名称:mono,代码行数:33,代码来源:FaultConverter.cs
示例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);
}
开发者ID:Hdesai,项目名称:XBuildLight,代码行数:32,代码来源:ErrorHandlerHelper.cs
示例4: XmlRpcMessage
public XmlRpcMessage(MessageFault fault)
: this()
{
isFault = true;
bodyReader = XmlRpcDataContractSerializationHelper.CreateFaultReader(fault);
bodyReader.MoveToContent();
}
开发者ID:ehabqadah,项目名称:Distributed-Nodes-Network-Management,代码行数:7,代码来源:XmlRpcMessage.cs
示例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;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:FaultConverter.cs
示例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");
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:FaultException.cs
示例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");
}
开发者ID:nickchal,项目名称:pash,代码行数:8,代码来源:FaultExceptionTest.cs
示例8: SdmxMessageFault
public SdmxMessageFault(MessageFault messageFault, string nameSpace)
{
if (messageFault == null)
{
throw new ArgumentNullException("messageFault");
}
this._messageFault = messageFault;
this._nameSpace = nameSpace;
}
开发者ID:alcardac,项目名称:SDMXRI_ENH_WS,代码行数:10,代码来源:SdmxMessageFault.cs
示例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;
}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:10,代码来源:FaultException.cs
示例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));
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:CompletionCoordinator.cs
示例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);
}
}
开发者ID:jandppw,项目名称:ppwcode-recovered-from-google-code,代码行数:12,代码来源:ErrorHandlerHelper.cs
示例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
{}
}
开发者ID:JMnITup,项目名称:SMEX,代码行数:12,代码来源:ErrorHandlerHelper.cs
示例13: GetBaseFaultCode
public static FaultCode GetBaseFaultCode(MessageFault fault)
{
FaultCode subCode = fault.Code;
if (subCode != null)
{
while (subCode.SubCode != null)
{
subCode = subCode.SubCode;
}
}
return subCode;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:Library.cs
示例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;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:Library.cs
示例16: CreateFaultException
protected override FaultException CreateFaultException(MessageFault messageFault, string action)
{
IList<XmlSerializerOperationBehavior.Reflector.XmlSerializerFaultContractInfo> faultInfos;
if (action != null)
{
faultInfos = new List<XmlSerializerOperationBehavior.Reflector.XmlSerializerFaultContractInfo>();
for (int i = 0; i < _xmlSerializerFaultContractInfos.Count; i++)
{
if (_xmlSerializerFaultContractInfos[i].FaultContractInfo.Action == action
|| _xmlSerializerFaultContractInfos[i].FaultContractInfo.Action == MessageHeaders.WildcardAction)
{
faultInfos.Add(_xmlSerializerFaultContractInfos[i]);
}
}
}
else
{
faultInfos = _xmlSerializerFaultContractInfos;
}
Type detailType = null;
object detailObj = null;
for (int i = 0; i < faultInfos.Count; i++)
{
XmlSerializerOperationBehavior.Reflector.XmlSerializerFaultContractInfo faultInfo = faultInfos[i];
XmlDictionaryReader detailReader = messageFault.GetReaderAtDetailContents();
XmlObjectSerializer serializer = faultInfo.Serializer;
if (serializer.IsStartObject(detailReader))
{
detailType = faultInfo.FaultContractInfo.Detail;
try
{
detailObj = serializer.ReadObject(detailReader);
FaultException faultException = CreateFaultException(messageFault, action,
detailObj, detailType, detailReader);
if (faultException != null)
return faultException;
}
catch (SerializationException)
{
}
}
}
return new FaultException(messageFault, action);
}
开发者ID:SoumikMukherjeeDOTNET,项目名称:wcf,代码行数:46,代码来源:XmlSerializerFaultFormatter.cs
示例17: CreateFaultException
protected override FaultException CreateFaultException(MessageFault messageFault, string action)
{
IList<XmlSerializerOperationBehavior.Reflector.XmlSerializerFaultContractInfo> xmlSerializerFaultContractInfos;
if (action != null)
{
xmlSerializerFaultContractInfos = new List<XmlSerializerOperationBehavior.Reflector.XmlSerializerFaultContractInfo>();
for (int j = 0; j < this.xmlSerializerFaultContractInfos.Count; j++)
{
if ((this.xmlSerializerFaultContractInfos[j].FaultContractInfo.Action == action) || (this.xmlSerializerFaultContractInfos[j].FaultContractInfo.Action == "*"))
{
xmlSerializerFaultContractInfos.Add(this.xmlSerializerFaultContractInfos[j]);
}
}
}
else
{
xmlSerializerFaultContractInfos = this.xmlSerializerFaultContractInfos;
}
System.Type detailType = null;
object detailObj = null;
for (int i = 0; i < xmlSerializerFaultContractInfos.Count; i++)
{
XmlSerializerOperationBehavior.Reflector.XmlSerializerFaultContractInfo info = xmlSerializerFaultContractInfos[i];
XmlDictionaryReader readerAtDetailContents = messageFault.GetReaderAtDetailContents();
XmlObjectSerializer serializer = info.Serializer;
if (serializer.IsStartObject(readerAtDetailContents))
{
detailType = info.FaultContractInfo.Detail;
try
{
detailObj = serializer.ReadObject(readerAtDetailContents);
FaultException exception = base.CreateFaultException(messageFault, action, detailObj, detailType, readerAtDetailContents);
if (exception != null)
{
return exception;
}
}
catch (SerializationException)
{
}
}
}
return new FaultException(messageFault, action);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:44,代码来源:XmlSerializerFaultFormatter.cs
示例18: GetFaultCodeReason
public static string GetFaultCodeReason(MessageFault fault)
{
FaultReasonText matchingTranslation;
FaultReason reason = fault.Reason;
if (reason == null)
{
return "unknown";
}
try
{
matchingTranslation = reason.GetMatchingTranslation(CultureInfo.CurrentCulture);
}
catch (ArgumentException exception)
{
Microsoft.Transactions.Bridge.DiagnosticUtility.ExceptionUtility.TraceHandledException(exception, TraceEventType.Warning);
return "unknown";
}
return matchingTranslation.Text;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:19,代码来源:Library.cs
示例19: OnTryCreateException
protected override bool OnTryCreateException(Message message, MessageFault fault, out Exception exception)
{
if (_innerChannel == null)
{
exception = null;
return false;
}
FaultConverter inner = _innerChannel.GetProperty<FaultConverter>();
if (inner != null)
{
return inner.TryCreateException(message, fault, out exception);
}
else
{
exception = null;
return false;
}
}
开发者ID:SoumikMukherjeeDOTNET,项目名称:wcf,代码行数:19,代码来源:SecurityChannelFaultConverter.cs
示例20: CreateFault
public static CoordinatorRegistrationFailedFault CreateFault(MessageFault fault)
{
string str;
if (fault == null)
{
str = Microsoft.Transactions.SR.GetString("CoordinatorRegistrationFailedReason");
}
else
{
string faultCodeName = Library.GetFaultCodeName(fault);
if (faultCodeName == null)
{
str = Microsoft.Transactions.SR.GetString("CoordinatorRegistrationFaultedUnknownReason");
}
else
{
str = Microsoft.Transactions.SR.GetString("CoordinatorRegistrationFaultedReason", new object[] { faultCodeName });
}
}
return new CoordinatorRegistrationFailedFault(str);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:21,代码来源:CoordinatorRegistrationFailedFault.cs
注:本文中的MessageFault类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论