本文整理汇总了C#中System.ServiceModel.Dispatcher.MessageRpc.Abort方法的典型用法代码示例。如果您正苦于以下问题:C# MessageRpc.Abort方法的具体用法?C# MessageRpc.Abort怎么用?C# MessageRpc.Abort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ServiceModel.Dispatcher.MessageRpc
的用法示例。
在下文中一共展示了MessageRpc.Abort方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrepareReply
private void PrepareReply(ref MessageRpc rpc)
{
RequestContext context = rpc.OperationContext.RequestContext;
Exception exception = null;
bool thereIsAnUnhandledException = false;
if (!rpc.Operation.IsOneWay)
{
if ((context != null) && (rpc.Reply != null))
{
try
{
rpc.CanSendReply = PrepareAndAddressReply(ref rpc);
}
catch (Exception e)
{
if (Fx.IsFatal(e))
{
throw;
}
thereIsAnUnhandledException = !_error.HandleError(e);
exception = e;
}
}
}
if (rpc.Operation.IsOneWay)
{
rpc.CanSendReply = false;
}
if (!rpc.Operation.IsOneWay && (context != null) && (rpc.Reply != null))
{
if (exception != null)
{
// We don't call ProvideFault again, since we have already passed the
// point where SFx addresses the reply, and it is reasonable for
// ProvideFault to expect that SFx will address the reply. Instead
// we always just do 'internal server error' processing.
rpc.Error = exception;
_error.ProvideOnlyFaultOfLastResort(ref rpc);
try
{
rpc.CanSendReply = PrepareAndAddressReply(ref rpc);
}
catch (Exception e)
{
if (Fx.IsFatal(e))
{
throw;
}
_error.HandleError(e);
}
}
}
else if ((exception != null) && thereIsAnUnhandledException)
{
rpc.Abort();
}
}
示例2: PrepareReply
void PrepareReply(ref MessageRpc rpc)
{
RequestContext context = rpc.OperationContext.RequestContext;
Exception exception = null;
bool thereIsAnUnhandledException = false;
if (!rpc.Operation.IsOneWay)
{
if (DiagnosticUtility.ShouldTraceWarning)
{
// If a service both returns null and sets RequestContext null, that
// means they handled it (either by calling Close or Reply manually).
// These traces catch accidents, where you accidentally return null,
// or you accidentally close the context so we can't return your message.
if ((rpc.Reply == null) && (context != null))
{
TraceUtility.TraceEvent(System.Diagnostics.TraceEventType.Warning,
TraceCode.ServiceOperationMissingReply,
SR.GetString(SR.TraceCodeServiceOperationMissingReply, rpc.Operation.Name ?? String.Empty),
null, null);
}
else if ((context == null) && (rpc.Reply != null))
{
TraceUtility.TraceEvent(System.Diagnostics.TraceEventType.Warning,
TraceCode.ServiceOperationMissingReplyContext,
SR.GetString(SR.TraceCodeServiceOperationMissingReplyContext, rpc.Operation.Name ?? String.Empty),
null, null);
}
}
if ((context != null) && (rpc.Reply != null))
{
try
{
rpc.CanSendReply = PrepareAndAddressReply(ref rpc);
}
catch (Exception e)
{
if (Fx.IsFatal(e))
{
throw;
}
thereIsAnUnhandledException = (!this.error.HandleError(e)) || thereIsAnUnhandledException;
exception = e;
}
}
}
this.BeforeSendReply(ref rpc, ref exception, ref thereIsAnUnhandledException);
if (rpc.Operation.IsOneWay)
{
rpc.CanSendReply = false;
}
if (!rpc.Operation.IsOneWay && (context != null) && (rpc.Reply != null))
{
if (exception != null)
{
// We don't call ProvideFault again, since we have already passed the
// point where SFx addresses the reply, and it is reasonable for
// ProvideFault to expect that SFx will address the reply. Instead
// we always just do 'internal server error' processing.
rpc.Error = exception;
this.error.ProvideOnlyFaultOfLastResort(ref rpc);
try
{
rpc.CanSendReply = PrepareAndAddressReply(ref rpc);
}
catch (Exception e)
{
if (Fx.IsFatal(e))
{
throw;
}
this.error.HandleError(e);
}
}
}
else if ((exception != null) && thereIsAnUnhandledException)
{
rpc.Abort();
}
}
示例3: PrepareReply
private void PrepareReply(ref MessageRpc rpc)
{
RequestContext requestContext = rpc.OperationContext.RequestContext;
Exception exception = null;
bool thereIsAnUnhandledException = false;
if (!rpc.Operation.IsOneWay)
{
if (DiagnosticUtility.ShouldTraceWarning)
{
if ((rpc.Reply == null) && (requestContext != null))
{
object[] args = new object[] { rpc.Operation.Name ?? string.Empty };
TraceUtility.TraceEvent(TraceEventType.Warning, 0x80032, System.ServiceModel.SR.GetString("TraceCodeServiceOperationMissingReply", args), (Exception) null, (Message) null);
}
else if ((requestContext == null) && (rpc.Reply != null))
{
object[] objArray2 = new object[] { rpc.Operation.Name ?? string.Empty };
TraceUtility.TraceEvent(TraceEventType.Warning, 0x80033, System.ServiceModel.SR.GetString("TraceCodeServiceOperationMissingReplyContext", objArray2), (Exception) null, (Message) null);
}
}
if ((requestContext != null) && (rpc.Reply != null))
{
try
{
rpc.CanSendReply = this.PrepareAndAddressReply(ref rpc);
}
catch (Exception exception2)
{
if (Fx.IsFatal(exception2))
{
throw;
}
thereIsAnUnhandledException = !this.error.HandleError(exception2) || thereIsAnUnhandledException;
exception = exception2;
}
}
}
this.BeforeSendReply(ref rpc, ref exception, ref thereIsAnUnhandledException);
if (rpc.Operation.IsOneWay)
{
rpc.CanSendReply = false;
}
if ((!rpc.Operation.IsOneWay && (requestContext != null)) && (rpc.Reply != null))
{
if (exception == null)
{
return;
}
rpc.Error = exception;
this.error.ProvideOnlyFaultOfLastResort(ref rpc);
try
{
rpc.CanSendReply = this.PrepareAndAddressReply(ref rpc);
return;
}
catch (Exception exception3)
{
if (Fx.IsFatal(exception3))
{
throw;
}
this.error.HandleError(exception3);
return;
}
}
if ((exception != null) && thereIsAnUnhandledException)
{
rpc.Abort();
}
}