本文整理汇总了C#中System.ServiceModel.Dispatcher.MessageRpc.CloseRequestContext方法的典型用法代码示例。如果您正苦于以下问题:C# MessageRpc.CloseRequestContext方法的具体用法?C# MessageRpc.CloseRequestContext怎么用?C# MessageRpc.CloseRequestContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ServiceModel.Dispatcher.MessageRpc
的用法示例。
在下文中一共展示了MessageRpc.CloseRequestContext方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessMessageCleanup
private void ProcessMessageCleanup(ref MessageRpc rpc)
{
Fx.Assert(
!object.ReferenceEquals(rpc.ErrorProcessor, _processMessageCleanupError),
"ProcessMessageCleanup run twice on the same MessageRpc!");
rpc.ErrorProcessor = _processMessageCleanupError;
bool replyWasSent = false;
if (rpc.CanSendReply)
{
if (_sendAsynchronously)
{
replyWasSent = this.EndReply(ref rpc);
}
else
{
replyWasSent = rpc.SuccessfullySendReply;
}
}
try
{
try
{
if (rpc.DidDeserializeRequestBody)
{
rpc.Request.Close();
}
}
catch (Exception e)
{
if (Fx.IsFatal(e))
{
throw;
}
_error.HandleError(e);
}
rpc.DisposeParameters(false); //Dispose all input/output/return parameters
if (rpc.FaultInfo.IsConsideredUnhandled)
{
if (!replyWasSent)
{
rpc.AbortRequestContext();
rpc.AbortChannel();
}
else
{
rpc.CloseRequestContext();
rpc.CloseChannel();
}
rpc.AbortInstanceContext();
}
else
{
if (rpc.RequestContextThrewOnReply)
{
rpc.AbortRequestContext();
}
else
{
rpc.CloseRequestContext();
}
}
if ((rpc.Reply != null) && (rpc.Reply != rpc.ReturnParameter))
{
try
{
rpc.Reply.Close();
}
catch (Exception e)
{
if (Fx.IsFatal(e))
{
throw;
}
_error.HandleError(e);
}
}
if ((rpc.FaultInfo.Fault != null) && (rpc.FaultInfo.Fault.State != MessageState.Closed))
{
// maybe ProvideFault gave a Message, but then BeforeSendReply replaced it
// in that case, we need to close the one from ProvideFault
try
{
rpc.FaultInfo.Fault.Close();
}
catch (Exception e)
{
if (Fx.IsFatal(e))
{
throw;
}
_error.HandleError(e);
}
//.........这里部分代码省略.........
示例2: ProcessMessageCleanup
//.........这里部分代码省略.........
}
this.error.HandleError(e);
}
if (rpc.HostingProperty != null)
{
try
{
rpc.HostingProperty.Close();
}
catch (Exception e)
{
if (Fx.IsFatal(e))
{
throw;
}
throw DiagnosticUtility.ExceptionUtility.ThrowHelperFatal(e.Message, e);
}
}
// for wf, wf owns the lifetime of the request message. So in that case, we should not dispose the inputs
IManualConcurrencyOperationInvoker manualInvoker = rpc.Operation.Invoker as IManualConcurrencyOperationInvoker;
rpc.DisposeParameters(manualInvoker != null && manualInvoker.OwnsFormatter); //Dispose all input/output/return parameters
if (rpc.FaultInfo.IsConsideredUnhandled)
{
if (!replyWasSent)
{
rpc.AbortRequestContext();
rpc.AbortChannel();
}
else
{
rpc.CloseRequestContext();
rpc.CloseChannel();
}
rpc.AbortInstanceContext();
}
else
{
if (rpc.RequestContextThrewOnReply)
{
rpc.AbortRequestContext();
}
else
{
rpc.CloseRequestContext();
}
}
if ((rpc.Reply != null) && (rpc.Reply != rpc.ReturnParameter))
{
try
{
rpc.Reply.Close();
}
catch (Exception e)
{
if (Fx.IsFatal(e))
{
throw;
}
this.error.HandleError(e);
}
}
示例3: ProcessMessageCleanup
private void ProcessMessageCleanup(ref MessageRpc rpc)
{
rpc.ErrorProcessor = this.processMessageCleanupError;
bool successfullySendReply = false;
if (rpc.CanSendReply)
{
if (this.sendAsynchronously)
{
successfullySendReply = this.EndReply(ref rpc);
}
else
{
successfullySendReply = rpc.SuccessfullySendReply;
}
}
try
{
try
{
if (rpc.DidDeserializeRequestBody)
{
rpc.Request.Close();
}
}
catch (Exception exception)
{
if (Fx.IsFatal(exception))
{
throw;
}
this.error.HandleError(exception);
}
if (rpc.HostingProperty != null)
{
try
{
rpc.HostingProperty.Close();
}
catch (Exception exception2)
{
if (Fx.IsFatal(exception2))
{
throw;
}
throw DiagnosticUtility.ExceptionUtility.ThrowHelperFatal(exception2.Message, exception2);
}
}
IManualConcurrencyOperationInvoker invoker = rpc.Operation.Invoker as IManualConcurrencyOperationInvoker;
rpc.DisposeParameters((invoker != null) && invoker.OwnsFormatter);
if (rpc.FaultInfo.IsConsideredUnhandled)
{
if (!successfullySendReply)
{
rpc.AbortRequestContext();
rpc.AbortChannel();
}
else
{
rpc.CloseRequestContext();
rpc.CloseChannel();
}
rpc.AbortInstanceContext();
}
else if (rpc.RequestContextThrewOnReply)
{
rpc.AbortRequestContext();
}
else
{
rpc.CloseRequestContext();
}
if ((rpc.Reply != null) && (rpc.Reply != rpc.ReturnParameter))
{
try
{
rpc.Reply.Close();
}
catch (Exception exception3)
{
if (Fx.IsFatal(exception3))
{
throw;
}
this.error.HandleError(exception3);
}
}
if ((rpc.FaultInfo.Fault != null) && (rpc.FaultInfo.Fault.State != MessageState.Closed))
{
try
{
rpc.FaultInfo.Fault.Close();
}
catch (Exception exception4)
{
if (Fx.IsFatal(exception4))
{
throw;
}
this.error.HandleError(exception4);
}
//.........这里部分代码省略.........