Пример #1
0
 /// <summary>
 /// Forcibly terminate and dispose the request, closing the connection if necessary.
 /// </summary>
 public void Abort()
 {
     // May be called from Dispose() code path, don't check _disposed.
     // TODO: Verbose log
     _disposed = true;
     if (_requestAbortSource != null)
     {
         try
         {
             _requestAbortSource.Cancel();
         }
         catch (ObjectDisposedException)
         {
         }
         catch (Exception ex)
         {
             Log.AbortError(Logger, ex);
         }
         _requestAbortSource.Dispose();
     }
     else
     {
         _disconnectToken = new CancellationToken(canceled: true);
     }
     ForceCancelRequest();
     Request.Dispose();
     // Only Abort, Response.Dispose() tries a graceful flush
     Response.Abort();
 }
Пример #2
0
 public void Abort()
 {
     Response.Abort();
     OnContextClosed();
 }