本文整理汇总了C#中System.ServiceModel.FaultCode类的典型用法代码示例。如果您正苦于以下问题:C# FaultCode类的具体用法?C# FaultCode怎么用?C# FaultCode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FaultCode类属于System.ServiceModel命名空间,在下文中一共展示了FaultCode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Fault
public Fault(string action, FaultCode code, string reasonText)
{
this.action = action;
this.code = code;
this.reasonText = reasonText;
this.reason = new FaultReason(reasonText, CultureInfo.CurrentCulture);
}
示例2: HandleClientFaultException
private FaultException HandleClientFaultException(Exception exception, Guid errorId)
{
string clientMessage = "The operation could not be performed. Reason: internal server error.";
FaultCode code = new FaultCode(exception.GetType().Name);
string errorMessage = String.Format("{0} Error Id: [{1}].{2}{3}", clientMessage, errorId, Environment.NewLine, Logger.ErrorLogEntityToString(Logger.GetExceptionLogEntity(exception)));
return new FaultException(new FaultReason(errorMessage), FaultCode.CreateReceiverFaultCode(code));
}
示例3: ProvideFaultOfLastResort
void ProvideFaultOfLastResort(Exception error, ref ErrorHandlerFaultInfo faultInfo)
{
if (faultInfo.Fault == null)
{
FaultCode code = new FaultCode(FaultCodeConstants.Codes.InternalServiceFault, FaultCodeConstants.Namespaces.NetDispatch);
code = FaultCode.CreateReceiverFaultCode(code);
string action = FaultCodeConstants.Actions.NetDispatcher;
MessageFault fault;
if (this.debug)
{
faultInfo.DefaultFaultAction = action;
fault = MessageFault.CreateFault(code, new FaultReason(error.Message), new ExceptionDetail(error));
}
else
{
string reason = this.isOnServer ? SR.GetString(SR.SFxInternalServerError) : SR.GetString(SR.SFxInternalCallbackError);
fault = MessageFault.CreateFault(code, new FaultReason(reason));
}
faultInfo.IsConsideredUnhandled = true;
faultInfo.Fault = Message.CreateMessage(this.messageVersion, fault, action);
}
//if this is an InternalServiceFault coming from another service dispatcher we should treat it as unhandled so that the channels are cleaned up
else if (error != null)
{
FaultException e = error as FaultException;
if (e != null && e.Fault != null && e.Fault.Code != null && e.Fault.Code.SubCode != null &&
string.Compare(e.Fault.Code.SubCode.Namespace, FaultCodeConstants.Namespaces.NetDispatch, StringComparison.Ordinal) == 0 &&
string.Compare(e.Fault.Code.SubCode.Name, FaultCodeConstants.Codes.InternalServiceFault, StringComparison.Ordinal) == 0)
{
faultInfo.IsConsideredUnhandled = true;
}
}
}
示例4: FaultCode
public FaultCode(string name, string ns, FaultCode subCode)
{
if (name == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("name"));
}
if (name.Length == 0)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("name"));
}
if (!string.IsNullOrEmpty(ns))
{
NamingHelper.CheckUriParameter(ns, "ns");
}
this.name = name;
this.ns = ns;
this.subCode = subCode;
if (ns == "http://www.w3.org/2003/05/soap-envelope")
{
this.version = EnvelopeVersion.Soap12;
}
else if (ns == "http://schemas.xmlsoap.org/soap/envelope/")
{
this.version = EnvelopeVersion.Soap11;
}
else if (ns == "http://schemas.microsoft.com/ws/2005/05/envelope/none")
{
this.version = EnvelopeVersion.None;
}
else
{
this.version = null;
}
}
示例5: CreateWsrmHeaderFault
private static WsrmHeaderFault CreateWsrmHeaderFault(ReliableMessagingVersion reliableMessagingVersion, FaultCode code, string subcode, FaultReason reason, XmlDictionaryReader detailReader)
{
if (code.IsSenderFault)
{
if (subcode == "InvalidAcknowledgement")
{
return new InvalidAcknowledgementFault(code, reason, detailReader, reliableMessagingVersion);
}
if (subcode == "MessageNumberRollover")
{
return new MessageNumberRolloverFault(code, reason, detailReader, reliableMessagingVersion);
}
if (subcode == "UnknownSequence")
{
return new UnknownSequenceFault(code, reason, detailReader, reliableMessagingVersion);
}
if (reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessagingFebruary2005)
{
if (subcode == "LastMessageNumberExceeded")
{
return new LastMessageNumberExceededFault(code, reason, detailReader, reliableMessagingVersion);
}
}
else if ((reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11) && (subcode == "SequenceClosed"))
{
return new SequenceClosedFault(code, reason, detailReader, reliableMessagingVersion);
}
}
if (!code.IsSenderFault && !code.IsReceiverFault)
{
return null;
}
return new SequenceTerminatedFault(code, reason, detailReader, reliableMessagingVersion);
}
示例6: Check
public virtual bool Check(FaultCode code)
{
return code.IsReceiverFault &&
code.SubCode != null &&
CheckCodeName(code) &&
CheckCodeNamespace(code);
}
示例7: 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");
}
示例8: TestDefaults
public void TestDefaults ()
{
code = new FaultCode ("foo");
Assert.AreEqual ("foo", code.Name);
Assert.AreEqual (String.Empty, code.Namespace);
Assert.AreEqual (null, code.SubCode);
}
示例9: FaultException
internal FaultException(string reason, FaultCode code, string action, Exception innerException)
: base(reason, innerException)
{
this.code = FaultException.EnsureCode(code);
this.reason = FaultException.CreateReason(reason);
this.action = action;
}
示例10: WsrmFault
// remote
protected WsrmFault(FaultCode code, string subcode, FaultReason reason)
{
this.code = code;
this.subcode = subcode;
this.reason = reason;
this.isRemote = true;
}
示例11: CreateMessage
public Message CreateMessage(MessageVersion messageVersion, ReliableMessagingVersion reliableMessagingVersion)
{
this.SetReliableMessagingVersion(reliableMessagingVersion);
string faultActionString = WsrmIndex.GetFaultActionString(messageVersion.Addressing, reliableMessagingVersion);
if (messageVersion.Envelope == EnvelopeVersion.Soap11)
{
this.code = this.Get11Code(this.code, this.subcode);
}
else
{
if (messageVersion.Envelope != EnvelopeVersion.Soap12)
{
throw Fx.AssertAndThrow("Unsupported MessageVersion.");
}
if (this.code.SubCode == null)
{
FaultCode subCode = new FaultCode(this.subcode, WsrmIndex.GetNamespaceString(reliableMessagingVersion));
this.code = new FaultCode(this.code.Name, this.code.Namespace, subCode);
}
this.hasDetail = this.Get12HasDetail();
}
Message message = Message.CreateMessage(messageVersion, this, faultActionString);
this.OnFaultMessageCreated(messageVersion, message);
return message;
}
示例12: FaultException
internal FaultException(FaultReason reason, FaultCode code, string action, Exception innerException)
: base(FaultException.GetSafeReasonText(reason), innerException)
{
_code = FaultException.EnsureCode(code);
_reason = FaultException.EnsureReason(reason);
_action = action;
}
示例13: CreateInstanceNotFoundFault
public static OperationExecutionFault CreateInstanceNotFoundFault(string description)
{
if (instanceNotFoundCode == null)
{
instanceNotFoundCode = new FaultCode(XD2.WorkflowControlServiceFaults.InstanceNotFound, XD2.WorkflowServices.Namespace);
}
return new OperationExecutionFault(description, instanceNotFoundCode);
}
示例14: MakeConnectionMessageFault
protected MakeConnectionMessageFault(Message message, FaultCode code, string subcode, FaultReason reason)
{
this.code = code;
this.subcode = subcode;
this.reason = reason;
this.isRemote = true;
this.originalMessageId = message.Headers.MessageId;
}
示例15: CreateSuspendedFault
public static OperationExecutionFault CreateSuspendedFault(Guid instanceId, string operationName)
{
if (instanceSuspendedFaultCode == null)
{
instanceSuspendedFaultCode = new FaultCode("InstanceSuspended", "http://schemas.datacontract.org/2008/10/WorkflowServices");
}
return new OperationExecutionFault(System.ServiceModel.Activities.SR.InstanceSuspended(operationName, instanceId), instanceSuspendedFaultCode);
}