SharedHttpTransportManager.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  1. //----------------------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //----------------------------------------------------------------------------
  4. namespace System.ServiceModel.Channels
  5. {
  6. using System.Diagnostics;
  7. using System.Net;
  8. using System.Runtime;
  9. using System.Security;
  10. using System.Security.Authentication.ExtendedProtection;
  11. using System.ServiceModel;
  12. using System.ServiceModel.Diagnostics;
  13. using System.ServiceModel.Diagnostics.Application;
  14. using System.ServiceModel.Dispatcher;
  15. using System.Threading;
  16. using System.Runtime.Diagnostics;
  17. class SharedHttpTransportManager : HttpTransportManager
  18. {
  19. int maxPendingAccepts;
  20. HttpListener listener;
  21. ManualResetEvent listenStartedEvent;
  22. Exception listenStartedException;
  23. AsyncCallback onGetContext;
  24. AsyncCallback onContextReceived;
  25. Action onMessageDequeued;
  26. Action<object> onCompleteGetContextLater;
  27. bool unsafeConnectionNtlmAuthentication;
  28. ReaderWriterLockSlim listenerRWLock;
  29. internal SharedHttpTransportManager(Uri listenUri, HttpChannelListener channelListener)
  30. : base(listenUri, channelListener.HostNameComparisonMode, channelListener.Realm)
  31. {
  32. this.onGetContext = Fx.ThunkCallback(new AsyncCallback(OnGetContext));
  33. this.onMessageDequeued = new Action(OnMessageDequeued);
  34. this.unsafeConnectionNtlmAuthentication = channelListener.UnsafeConnectionNtlmAuthentication;
  35. this.onContextReceived = new AsyncCallback(this.HandleHttpContextReceived);
  36. this.listenerRWLock = new ReaderWriterLockSlim();
  37. this.maxPendingAccepts = channelListener.MaxPendingAccepts;
  38. }
  39. // We are NOT checking the RequestInitializationTimeout here since the HttpChannelListener should be handle them
  40. // individually. However, some of the scenarios might be impacted, e.g., if we have one endpoint with high RequestInitializationTimeout
  41. // and the other is just normal, the first endpoint might be occupying all the receiving loops, then the requests to the normal endpoint
  42. // will experience timeout issues. The mitigation for this issue is that customers should be able to increase the MaxPendingAccepts number.
  43. internal override bool IsCompatible(HttpChannelListener channelListener)
  44. {
  45. if (channelListener.InheritBaseAddressSettings)
  46. return true;
  47. if (!channelListener.IsScopeIdCompatible(HostNameComparisonMode, this.ListenUri))
  48. {
  49. return false;
  50. }
  51. if (this.maxPendingAccepts != channelListener.MaxPendingAccepts)
  52. {
  53. return false;
  54. }
  55. return channelListener.UnsafeConnectionNtlmAuthentication == this.unsafeConnectionNtlmAuthentication
  56. && base.IsCompatible(channelListener);
  57. }
  58. internal override void OnClose(TimeSpan timeout)
  59. {
  60. Cleanup(false, timeout);
  61. }
  62. internal override void OnAbort()
  63. {
  64. Cleanup(true, TimeSpan.Zero);
  65. base.OnAbort();
  66. }
  67. void Cleanup(bool aborting, TimeSpan timeout)
  68. {
  69. using (LockHelper.TakeWriterLock(this.listenerRWLock))
  70. {
  71. HttpListener listenerSnapshot = this.listener;
  72. if (listenerSnapshot == null)
  73. {
  74. return;
  75. }
  76. try
  77. {
  78. listenerSnapshot.Stop();
  79. }
  80. finally
  81. {
  82. try
  83. {
  84. listenerSnapshot.Close();
  85. }
  86. finally
  87. {
  88. if (!aborting)
  89. {
  90. base.OnClose(timeout);
  91. }
  92. else
  93. {
  94. base.OnAbort();
  95. }
  96. }
  97. }
  98. this.listener = null;
  99. }
  100. }
  101. [Fx.Tag.SecurityNote(Critical = "Calls into critical method ExecutionContext.SuppressFlow",
  102. Safe = "Doesn't leak information\\resources; the callback that is invoked is safe")]
  103. [SecuritySafeCritical]
  104. IAsyncResult BeginGetContext(bool startListening)
  105. {
  106. EventTraceActivity eventTraceActivity = null;
  107. if (FxTrace.Trace.IsEnd2EndActivityTracingEnabled)
  108. {
  109. eventTraceActivity = EventTraceActivity.GetFromThreadOrCreate(true);
  110. if (TD.HttpGetContextStartIsEnabled())
  111. {
  112. TD.HttpGetContextStart(eventTraceActivity);
  113. }
  114. }
  115. while (true)
  116. {
  117. Exception unexpectedException = null;
  118. try
  119. {
  120. try
  121. {
  122. if (ExecutionContext.IsFlowSuppressed())
  123. {
  124. return this.BeginGetContextCore(eventTraceActivity);
  125. }
  126. else
  127. {
  128. using (ExecutionContext.SuppressFlow())
  129. {
  130. return this.BeginGetContextCore(eventTraceActivity);
  131. }
  132. }
  133. }
  134. catch (HttpListenerException e)
  135. {
  136. if (!this.HandleHttpException(e))
  137. {
  138. throw;
  139. }
  140. }
  141. }
  142. catch (Exception e)
  143. {
  144. if (Fx.IsFatal(e))
  145. {
  146. throw;
  147. }
  148. if (startListening)
  149. {
  150. // Since we're under a call to StartListening(), just throw the exception up the stack.
  151. throw;
  152. }
  153. unexpectedException = e;
  154. }
  155. if (unexpectedException != null)
  156. {
  157. this.Fault(unexpectedException);
  158. return null;
  159. }
  160. }
  161. }
  162. IAsyncResult BeginGetContextCore(EventTraceActivity eventTraceActivity)
  163. {
  164. using (LockHelper.TakeReaderLock(this.listenerRWLock))
  165. {
  166. if (this.listener == null)
  167. {
  168. return null;
  169. }
  170. return this.listener.BeginGetContext(onGetContext, eventTraceActivity);
  171. }
  172. }
  173. void OnGetContext(IAsyncResult result)
  174. {
  175. if (result.CompletedSynchronously)
  176. {
  177. return;
  178. }
  179. OnGetContextCore(result);
  180. }
  181. void OnCompleteGetContextLater(object state)
  182. {
  183. OnGetContextCore((IAsyncResult)state);
  184. }
  185. void OnGetContextCore(IAsyncResult listenerContextResult)
  186. {
  187. Fx.Assert(listenerContextResult != null, "listenerContextResult cannot be null.");
  188. bool enqueued = false;
  189. while (!enqueued)
  190. {
  191. Exception unexpectedException = null;
  192. try
  193. {
  194. try
  195. {
  196. enqueued = this.EnqueueContext(listenerContextResult);
  197. }
  198. catch (HttpListenerException e)
  199. {
  200. if (!this.HandleHttpException(e))
  201. {
  202. throw;
  203. }
  204. }
  205. }
  206. catch (Exception exception)
  207. {
  208. if (Fx.IsFatal(exception))
  209. {
  210. throw;
  211. }
  212. unexpectedException = exception;
  213. }
  214. if (unexpectedException != null)
  215. {
  216. this.Fault(unexpectedException);
  217. }
  218. // NormalHttpPipeline calls HttpListener.BeginGetContext() by itself (via its dequeuedCallback) in the short-circuit case
  219. // when there was no error processing the inboud request (see the comments in the NormalHttpPipeline.Close() for details).
  220. if (!enqueued) // onMessageDequeued will handle this in the enqueued case
  221. {
  222. // Continue the loop with the async result if it completed synchronously.
  223. listenerContextResult = this.BeginGetContext(false);
  224. if ((listenerContextResult == null) || !listenerContextResult.CompletedSynchronously)
  225. {
  226. return;
  227. }
  228. }
  229. }
  230. }
  231. bool EnqueueContext(IAsyncResult listenerContextResult)
  232. {
  233. EventTraceActivity eventTraceActivity = null;
  234. HttpListenerContext listenerContext;
  235. bool enqueued = false;
  236. if (FxTrace.Trace.IsEnd2EndActivityTracingEnabled)
  237. {
  238. eventTraceActivity = (EventTraceActivity)listenerContextResult.AsyncState;
  239. if (eventTraceActivity == null)
  240. {
  241. eventTraceActivity = EventTraceActivity.GetFromThreadOrCreate(true);
  242. }
  243. }
  244. using (LockHelper.TakeReaderLock(this.listenerRWLock))
  245. {
  246. if (this.listener == null)
  247. {
  248. return true;
  249. }
  250. listenerContext = this.listener.EndGetContext(listenerContextResult);
  251. }
  252. // Grab the activity from the context and set that as the surrounding activity.
  253. // If a message appears, we will transfer to the message's activity next
  254. using (DiagnosticUtility.ShouldUseActivity ? ServiceModelActivity.BoundOperation(this.Activity) : null)
  255. {
  256. ServiceModelActivity activity = DiagnosticUtility.ShouldUseActivity ? ServiceModelActivity.CreateBoundedActivityWithTransferInOnly(listenerContext.Request.RequestTraceIdentifier) : null;
  257. try
  258. {
  259. if (activity != null)
  260. {
  261. StartReceiveBytesActivity(activity, listenerContext.Request.Url);
  262. }
  263. if (DiagnosticUtility.ShouldTraceInformation)
  264. {
  265. TraceUtility.TraceHttpConnectionInformation(listenerContext.Request.LocalEndPoint.ToString(),
  266. listenerContext.Request.RemoteEndPoint.ToString(), this);
  267. }
  268. base.TraceMessageReceived(eventTraceActivity, this.ListenUri);
  269. HttpChannelListener channelListener;
  270. if (base.TryLookupUri(listenerContext.Request.Url,
  271. listenerContext.Request.HttpMethod,
  272. this.HostNameComparisonMode,
  273. listenerContext.Request.IsWebSocketRequest,
  274. out channelListener))
  275. {
  276. HttpRequestContext context = HttpRequestContext.CreateContext(channelListener, listenerContext, eventTraceActivity);
  277. IAsyncResult httpContextReceivedResult = channelListener.BeginHttpContextReceived(context,
  278. onMessageDequeued,
  279. onContextReceived,
  280. DiagnosticUtility.ShouldUseActivity ? (object)new ActivityHolder(activity, context) : (object)context);
  281. if (httpContextReceivedResult.CompletedSynchronously)
  282. {
  283. enqueued = EndHttpContextReceived(httpContextReceivedResult);
  284. }
  285. else
  286. {
  287. // The callback has been enqueued.
  288. enqueued = true;
  289. }
  290. }
  291. else
  292. {
  293. HandleMessageReceiveFailed(listenerContext);
  294. }
  295. }
  296. finally
  297. {
  298. if (DiagnosticUtility.ShouldUseActivity && activity != null)
  299. {
  300. if (!enqueued)
  301. {
  302. // Error during enqueuing
  303. activity.Dispose();
  304. }
  305. }
  306. }
  307. }
  308. return enqueued;
  309. }
  310. void HandleHttpContextReceived(IAsyncResult httpContextReceivedResult)
  311. {
  312. if (httpContextReceivedResult.CompletedSynchronously)
  313. {
  314. return;
  315. }
  316. bool enqueued = false;
  317. Exception unexpectedException = null;
  318. try
  319. {
  320. try
  321. {
  322. enqueued = EndHttpContextReceived(httpContextReceivedResult);
  323. }
  324. catch (HttpListenerException e)
  325. {
  326. if (!this.HandleHttpException(e))
  327. {
  328. throw;
  329. }
  330. }
  331. }
  332. catch (Exception exception)
  333. {
  334. if (Fx.IsFatal(exception))
  335. {
  336. throw;
  337. }
  338. unexpectedException = exception;
  339. }
  340. if (unexpectedException != null)
  341. {
  342. this.Fault(unexpectedException);
  343. }
  344. IAsyncResult listenerContextResult = null;
  345. if (!enqueued) // onMessageDequeued will handle this in the enqueued case
  346. {
  347. listenerContextResult = this.BeginGetContext(false);
  348. if ((listenerContextResult == null) || !listenerContextResult.CompletedSynchronously)
  349. {
  350. return;
  351. }
  352. // Handle the context and continue the receive loop.
  353. this.OnGetContextCore(listenerContextResult);
  354. }
  355. }
  356. static bool EndHttpContextReceived(IAsyncResult httpContextReceivedResult)
  357. {
  358. using (DiagnosticUtility.ShouldUseActivity ? (ActivityHolder)httpContextReceivedResult.AsyncState : null)
  359. {
  360. HttpChannelListener channelListener =
  361. (DiagnosticUtility.ShouldUseActivity ?
  362. ((ActivityHolder)httpContextReceivedResult.AsyncState).context :
  363. (HttpRequestContext)httpContextReceivedResult.AsyncState).Listener;
  364. return channelListener.EndHttpContextReceived(httpContextReceivedResult);
  365. }
  366. }
  367. bool HandleHttpException(HttpListenerException e)
  368. {
  369. switch (e.ErrorCode)
  370. {
  371. case UnsafeNativeMethods.ERROR_NOT_ENOUGH_MEMORY:
  372. case UnsafeNativeMethods.ERROR_OUTOFMEMORY:
  373. case UnsafeNativeMethods.ERROR_NO_SYSTEM_RESOURCES:
  374. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InsufficientMemoryException(SR.GetString(SR.InsufficentMemory), e));
  375. default:
  376. return ExceptionHandler.HandleTransportExceptionHelper(e);
  377. }
  378. }
  379. static void HandleMessageReceiveFailed(HttpListenerContext listenerContext)
  380. {
  381. TraceMessageReceiveFailed();
  382. // no match -- 405 or 404
  383. if (string.Compare(listenerContext.Request.HttpMethod, "POST", StringComparison.OrdinalIgnoreCase) != 0)
  384. {
  385. listenerContext.Response.StatusCode = (int)HttpStatusCode.MethodNotAllowed;
  386. listenerContext.Response.Headers.Add(HttpResponseHeader.Allow, "POST");
  387. }
  388. else
  389. {
  390. listenerContext.Response.StatusCode = (int)HttpStatusCode.NotFound;
  391. }
  392. listenerContext.Response.ContentLength64 = 0;
  393. listenerContext.Response.Close();
  394. }
  395. static void TraceMessageReceiveFailed()
  396. {
  397. if (TD.HttpMessageReceiveStartIsEnabled())
  398. {
  399. TD.HttpMessageReceiveFailed();
  400. }
  401. if (DiagnosticUtility.ShouldTraceWarning)
  402. {
  403. TraceUtility.TraceEvent(TraceEventType.Warning, TraceCode.HttpChannelMessageReceiveFailed,
  404. SR.GetString(SR.TraceCodeHttpChannelMessageReceiveFailed), (object)null);
  405. }
  406. }
  407. void StartListening()
  408. {
  409. for (int i = 0; i < maxPendingAccepts; i++)
  410. {
  411. IAsyncResult result = this.BeginGetContext(true);
  412. if (result.CompletedSynchronously)
  413. {
  414. if (onCompleteGetContextLater == null)
  415. {
  416. onCompleteGetContextLater = new Action<object>(OnCompleteGetContextLater);
  417. }
  418. ActionItem.Schedule(onCompleteGetContextLater, result);
  419. }
  420. }
  421. }
  422. void OnListening(object state)
  423. {
  424. try
  425. {
  426. this.StartListening();
  427. }
  428. catch (Exception e)
  429. {
  430. if (Fx.IsFatal(e))
  431. {
  432. throw;
  433. }
  434. this.listenStartedException = e;
  435. }
  436. finally
  437. {
  438. this.listenStartedEvent.Set();
  439. }
  440. }
  441. void OnMessageDequeued()
  442. {
  443. ThreadTrace.Trace("message dequeued");
  444. IAsyncResult result = this.BeginGetContext(false);
  445. if (result != null && result.CompletedSynchronously)
  446. {
  447. if (onCompleteGetContextLater == null)
  448. {
  449. onCompleteGetContextLater = new Action<object>(OnCompleteGetContextLater);
  450. }
  451. ActionItem.Schedule(onCompleteGetContextLater, result);
  452. }
  453. }
  454. internal override void OnOpen()
  455. {
  456. listener = new HttpListener();
  457. string host;
  458. switch (HostNameComparisonMode)
  459. {
  460. case HostNameComparisonMode.Exact:
  461. // Uri.DnsSafeHost strips the [], but preserves the scopeid for IPV6 addresses.
  462. if (ListenUri.HostNameType == UriHostNameType.IPv6)
  463. {
  464. host = string.Concat("[", ListenUri.DnsSafeHost, "]");
  465. }
  466. else
  467. {
  468. host = ListenUri.NormalizedHost();
  469. }
  470. break;
  471. case HostNameComparisonMode.StrongWildcard:
  472. host = "+";
  473. break;
  474. case HostNameComparisonMode.WeakWildcard:
  475. host = "*";
  476. break;
  477. default:
  478. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.UnrecognizedHostNameComparisonMode, HostNameComparisonMode.ToString())));
  479. }
  480. string path = ListenUri.GetComponents(UriComponents.Path, UriFormat.Unescaped);
  481. if (!path.StartsWith("/", StringComparison.Ordinal))
  482. path = "/" + path;
  483. if (!path.EndsWith("/", StringComparison.Ordinal))
  484. path = path + "/";
  485. string httpListenUrl = string.Concat(Scheme, "://", host, ":", ListenUri.Port, path);
  486. listener.UnsafeConnectionNtlmAuthentication = this.unsafeConnectionNtlmAuthentication;
  487. listener.AuthenticationSchemeSelectorDelegate =
  488. new AuthenticationSchemeSelector(SelectAuthenticationScheme);
  489. if (ExtendedProtectionPolicy.OSSupportsExtendedProtection)
  490. {
  491. //This API will throw if on an unsupported platform.
  492. listener.ExtendedProtectionSelectorDelegate =
  493. new HttpListener.ExtendedProtectionSelector(SelectExtendedProtectionPolicy);
  494. }
  495. if (this.Realm != null)
  496. {
  497. listener.Realm = this.Realm;
  498. }
  499. bool success = false;
  500. try
  501. {
  502. listener.Prefixes.Add(httpListenUrl);
  503. listener.Start();
  504. bool startedListening = false;
  505. try
  506. {
  507. if (Thread.CurrentThread.IsThreadPoolThread)
  508. {
  509. StartListening();
  510. }
  511. else
  512. {
  513. // If we're not on a threadpool thread, then we need to post a callback to start our accepting loop
  514. // Otherwise if the calling thread aborts then the async I/O will get inadvertantly cancelled
  515. listenStartedEvent = new ManualResetEvent(false);
  516. ActionItem.Schedule(OnListening, null);
  517. listenStartedEvent.WaitOne();
  518. listenStartedEvent.Close();
  519. listenStartedEvent = null;
  520. if (listenStartedException != null)
  521. {
  522. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(listenStartedException);
  523. }
  524. }
  525. startedListening = true;
  526. }
  527. finally
  528. {
  529. if (!startedListening)
  530. {
  531. listener.Stop();
  532. }
  533. }
  534. success = true;
  535. }
  536. catch (HttpListenerException listenerException)
  537. {
  538. switch (listenerException.NativeErrorCode)
  539. {
  540. case UnsafeNativeMethods.ERROR_ALREADY_EXISTS:
  541. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new AddressAlreadyInUseException(SR.GetString(SR.HttpRegistrationAlreadyExists, httpListenUrl), listenerException));
  542. case UnsafeNativeMethods.ERROR_SHARING_VIOLATION:
  543. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new AddressAlreadyInUseException(SR.GetString(SR.HttpRegistrationPortInUse, httpListenUrl, ListenUri.Port), listenerException));
  544. case UnsafeNativeMethods.ERROR_ACCESS_DENIED:
  545. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new AddressAccessDeniedException(SR.GetString(SR.HttpRegistrationAccessDenied, httpListenUrl), listenerException));
  546. case UnsafeNativeMethods.ERROR_ALLOTTED_SPACE_EXCEEDED:
  547. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new CommunicationException(SR.GetString(SR.HttpRegistrationLimitExceeded, httpListenUrl), listenerException));
  548. case UnsafeNativeMethods.ERROR_INVALID_PARAMETER:
  549. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.HttpInvalidListenURI, ListenUri.OriginalString), listenerException));
  550. default:
  551. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
  552. HttpChannelUtilities.CreateCommunicationException(listenerException));
  553. }
  554. }
  555. finally
  556. {
  557. if (!success)
  558. {
  559. listener.Abort();
  560. }
  561. }
  562. }
  563. AuthenticationSchemes SelectAuthenticationScheme(HttpListenerRequest request)
  564. {
  565. try
  566. {
  567. AuthenticationSchemes result;
  568. HttpChannelListener channelListener;
  569. if (base.TryLookupUri(request.Url, request.HttpMethod,
  570. this.HostNameComparisonMode, request.IsWebSocketRequest, out channelListener))
  571. {
  572. result = channelListener.AuthenticationScheme;
  573. }
  574. else
  575. {
  576. // if we don't match a listener factory, we want to "fall through" the
  577. // auth delegate code and run through our normal OnGetContext codepath.
  578. // System.Net treats "None" as Access Denied, which is not our intent here.
  579. // In most cases this will just fall through to the code that returns a "404 Not Found"
  580. result = AuthenticationSchemes.Anonymous;
  581. }
  582. return result;
  583. }
  584. catch (Exception e)
  585. {
  586. DiagnosticUtility.TraceHandledException(e, TraceEventType.Error);
  587. throw;
  588. }
  589. }
  590. ExtendedProtectionPolicy SelectExtendedProtectionPolicy(HttpListenerRequest request)
  591. {
  592. ExtendedProtectionPolicy result = null;
  593. try
  594. {
  595. HttpChannelListener channelListener;
  596. if (base.TryLookupUri(request.Url, request.HttpMethod,
  597. this.HostNameComparisonMode, request.IsWebSocketRequest, out channelListener))
  598. {
  599. result = channelListener.ExtendedProtectionPolicy;
  600. }
  601. else
  602. {
  603. //if the listener isn't found, then the auth scheme will be anonymous
  604. //(see SelectAuthenticationScheme function) and will fall through to the
  605. //404 Not Found code path, so it doesn't really matter what we return from here...
  606. result = ChannelBindingUtility.DisabledPolicy;
  607. }
  608. return result;
  609. }
  610. catch (Exception e)
  611. {
  612. DiagnosticUtility.TraceHandledException(e, TraceEventType.Error);
  613. throw;
  614. }
  615. }
  616. }
  617. }