private ExtensibleMessageInfo[] GetMessageInfo(long internalId) { TextFilter obj = new TextFilter(MessageInfoSchema.Identity, new MessageIdentity(internalId).ToString(), MatchOptions.FullString, MatchFlags.Default); byte[] queryFilterBytes = Serialization.ObjectToBytes(obj); byte[] sortOrder = Serialization.ObjectToBytes(QueueClient.emptySortOrder); int num = 0; int num2 = 0; Exception ex = null; try { byte[] queueViewerObjectPage = base.GetQueueViewerObjectPage(QVObjectType.MessageInfo, queryFilterBytes, sortOrder, true, int.MaxValue, null, -1, false, true, true, null, ref num, ref num2); return(this.GetExtensibleMessageInfo((MessageInfo[])Serialization.BytesToObject(queueViewerObjectPage))); } catch (RpcException ex2) { ex = ex2; } catch (SerializationException ex3) { ex = ex3; } TraceWrapper.SearchLibraryTracer.TraceError <Exception>(this.GetHashCode(), "RPC or Deserialize exception: {0}", ex); TrackingTransientException.AddAndRaiseETX(this.directoryContext.Errors, ErrorCode.QueueViewerConnectionFailure, this.serverName, ex.ToString()); return(null); }
private List <MessageTrackingLogEntry> ReadLogs(RpcReason rpcReason, string logFilePrefix, ProxyAddressCollection senderProxyAddresses, string messageId, DateTime startTime, DateTime endTime, TrackingEventBudget eventBudget) { Exception ex = null; int num = 0; List <MessageTrackingLogEntry> list = null; bool flag = !string.IsNullOrEmpty(messageId); bool flag2 = senderProxyAddresses != null; if (flag && flag2) { throw new InvalidOperationException("Cannot get logs with both message id and sender address criteria"); } if (rpcReason == RpcReason.None) { InfoWorkerMessageTrackingPerformanceCounters.GetMessageTrackingReportQueries.Increment(); } else { InfoWorkerMessageTrackingPerformanceCounters.SearchMessageTrackingReportQueries.Increment(); } try { this.context.DiagnosticsContext.LogRpcStart(this.server, rpcReason); using (LogSearchCursor cursor = TrackingSearch.GetCursor(this.server, this.version, logFilePrefix, messageId, senderProxyAddresses, startTime, endTime)) { list = this.ReadLogsFromCursor(cursor, eventBudget); } } catch (LogSearchException ex2) { ex = ex2; num = ex2.ErrorCode; } catch (RpcException ex3) { ex = ex3; num = ex3.ErrorCode; } finally { this.context.DiagnosticsContext.LogRpcEnd(ex, (list == null) ? 0 : list.Count); } if (ex != null) { TraceWrapper.SearchLibraryTracer.TraceError(this.GetHashCode(), "Error reading from log-search RPC server for {0}: {1}, ErrorCode: {2}, Exception: {3}", new object[] { flag ? "message id" : "sender", flag ? messageId : senderProxyAddresses[0].ToString(), num, ex }); TrackingTransientException.AddAndRaiseETX(this.context.Errors, ErrorCode.LogSearchConnection, this.server, ex.ToString()); } return(list); }
public static bool TryRead(string server, LogSearchCursor cursor, BitArray fieldsToGet, TrackingErrorCollection errors, out MessageTrackingLogRow logEntry) { logEntry = null; MessageTrackingLogRow messageTrackingLogRow = new MessageTrackingLogRow(); messageTrackingLogRow.serverFqdn = server; for (int i = 0; i < fieldsToGet.Length; i++) { if (fieldsToGet[i]) { object obj = null; Exception ex = null; try { obj = cursor.GetField(i); } catch (LogSearchException ex2) { ex = ex2; int errorCode = ex2.ErrorCode; } catch (RpcException ex3) { ex = ex3; int errorCode2 = ex3.ErrorCode; } if (ex != null) { TrackingTransientException.AddAndRaiseETX(errors, ErrorCode.LogSearchConnection, server, ex.ToString()); } if (obj != null && obj.GetType() != MessageTrackingSchema.MessageTrackingEvent.Fields[i].Type) { throw new InvalidOperationException(string.Format("Schema for column {0} in message-tracking is of sync with tasks", i)); } if (!MessageTrackingLogRow.ValidateField(messageTrackingLogRow, i, obj, errors)) { return(false); } messageTrackingLogRow.columns[i] = cursor.GetField(i); messageTrackingLogRow.validColumns[i] = true; } } if (fieldsToGet[8] && (messageTrackingLogRow.EventId == MessageTrackingEvent.EXPAND || messageTrackingLogRow.EventId == MessageTrackingEvent.RESOLVE)) { MessageTrackingLogRow.SmtpAddressValidatorWithNull(messageTrackingLogRow.RelatedRecipientAddress); } logEntry = messageTrackingLogRow; return(true); }
public Uri GetCasServerUri(ADObjectId site, int minServerVersionRequested, out int serverVersion) { SortedDictionary <int, List <WebServicesService> > uriVersions = null; serverVersion = 0; try { ServiceTopology currentServiceTopology = ServiceTopology.GetCurrentServiceTopology("f:\\15.00.1497\\sources\\dev\\infoworker\\src\\common\\MessageTracking\\ServerCache.cs", "GetCasServerUri", 673); currentServiceTopology.ForEach <WebServicesService>(delegate(WebServicesService service) { if (service.ServerVersionNumber >= minServerVersionRequested && service.Site.Id.Equals(site) && service.ClientAccessType == ClientAccessType.InternalNLBBypass) { if (uriVersions == null) { uriVersions = new SortedDictionary <int, List <WebServicesService> >(); } int key2 = service.ServerVersionNumber >> 16; if (!uriVersions.ContainsKey(key2)) { uriVersions[key2] = new List <WebServicesService>(); } uriVersions[key2].Add(service); } }, "f:\\15.00.1497\\sources\\dev\\infoworker\\src\\common\\MessageTracking\\ServerCache.cs", "GetCasServerUri", 674); } catch (ServiceDiscoveryTransientException ex) { TraceWrapper.SearchLibraryTracer.TraceError <ServiceDiscoveryTransientException>(this.GetHashCode(), "Transient exception getting Internal CAS URI: {0}", ex); TrackingTransientException.RaiseETX(ErrorCode.CASUriDiscoveryFailure, site.ToString(), ex.ToString()); } catch (ServiceDiscoveryPermanentException ex2) { TraceWrapper.SearchLibraryTracer.TraceError <ServiceDiscoveryPermanentException>(this.GetHashCode(), "Permanent exception getting Internal CAS URI: {0}", ex2); TrackingFatalException.RaiseETX(ErrorCode.CASUriDiscoveryFailure, site.ToString(), ex2.ToString()); } if (uriVersions != null && uriVersions.Count > 0) { int key = uriVersions.Last <KeyValuePair <int, List <WebServicesService> > >().Key; List <WebServicesService> value = uriVersions.Last <KeyValuePair <int, List <WebServicesService> > >().Value; int index = ServerCache.rand.Next(value.Count); WebServicesService webServicesService = value.ElementAt(index); TraceWrapper.SearchLibraryTracer.TraceDebug <Uri, string>(this.GetHashCode(), "Using CAS URI: {0}, Version {1}", webServicesService.Url, new ServerVersion(webServicesService.ServerVersionNumber).ToString()); serverVersion = webServicesService.ServerVersionNumber; return(webServicesService.Url); } TraceWrapper.SearchLibraryTracer.TraceError <string, string>(this.GetHashCode(), "Failed to find any CAS server in site: {0}, with min version {1}", site.ToString(), new ServerVersion(minServerVersionRequested).ToString()); return(null); }
private ResponseType TryCallWebServiceMethod <ResponseType, RequestType>(WebServiceBinding.WebMethodCallDelegate <ResponseType, RequestType> methodCall, RequestType request, out Exception exception) { exception = null; Exception ex = null; Exception ex2 = null; TrackingError trackingError = null; bool flag = false; try { this.directoryContext.Yield(); flag = true; return(methodCall(request)); } catch (InvalidOperationException ex3) { WebException ex4 = ex3 as WebException; if (ex4 != null) { trackingError = this.GetTrackingErrorForWebException(ex4, false); ex = ex3; } else { trackingError = new TrackingError(ErrorCode.UnexpectedErrorTransient, this.TargetInfoForDisplay, string.Format("WS call to {0} failed with InvalidOperationException", this.TargetInfoForDisplay), ex3.ToString()); ex2 = ex3; } } catch (SoapException ex5) { trackingError = new TrackingError(ErrorCode.UnexpectedErrorPermanent, this.TargetInfoForDisplay, string.Format("WS call to {0} failed with SoapException", this.TargetInfoForDisplay), ex5.ToString()); ex2 = ex5; } catch (SocketException ex6) { trackingError = new TrackingError(ErrorCode.Connectivity, this.TargetInfoForDisplay, string.Empty, ex6.ToString()); ex = ex6; } catch (InvalidParameterException ex7) { trackingError = new TrackingError(ErrorCode.UnexpectedErrorPermanent, this.TargetInfoForDisplay, string.Format("WS call to {0} failed with InvalidParameterException", this.TargetInfoForDisplay), ex7.ToString()); ex2 = ex7; } catch (SoapFaultException ex8) { trackingError = new TrackingError(ErrorCode.UnexpectedErrorPermanent, this.TargetInfoForDisplay, string.Format("WS call to {0} failed with SoapFaultException", this.TargetInfoForDisplay), ex8.ToString()); ex2 = ex8; } catch (TimeoutExpiredException ex9) { trackingError = new TrackingError(ErrorCode.TimeBudgetExceeded, this.TargetInfoForDisplay, string.Empty, ex9.ToString()); ex = ex9; } catch (ClientDisconnectedException ex10) { trackingError = new TrackingError(ErrorCode.Connectivity, this.TargetInfoForDisplay, string.Empty, ex10.ToString()); ex = ex10; } catch (AvailabilityException ex11) { trackingError = this.GetTrackingErrorForAvailabilityException(ex11); ex = ex11; } catch (AuthzException ex12) { trackingError = new TrackingError(ErrorCode.CrossForestAuthentication, this.TargetInfoForDisplay, string.Empty, ex12.ToString()); ex = ex12; } catch (OverBudgetException ex13) { trackingError = new TrackingError(ErrorCode.BudgetExceeded, this.TargetInfoForDisplay, string.Empty, ex13.ToString()); ex = ex13; } catch (InvalidFederatedOrganizationIdException ex14) { trackingError = new TrackingError(ErrorCode.CrossPremiseAuthentication, this.TargetInfoForDisplay, string.Empty, ex14.ToString()); ex2 = ex14; } catch (UserWithoutFederatedProxyAddressException ex15) { trackingError = new TrackingError(ErrorCode.CrossPremiseMisconfiguration, this.TargetInfoForDisplay, string.Empty, ex15.ToString()); ex2 = ex15; } finally { if (flag) { this.directoryContext.Acquire(); } } this.errors.Errors.Add(trackingError); if (ex != null) { exception = new TrackingTransientException(trackingError, ex, true); } else { exception = new TrackingTransientException(trackingError, ex2, true); } TraceWrapper.SearchLibraryTracer.TraceError <Exception>(this.GetHashCode(), "Exception in web-service call: {0}", (ex == null) ? ex2 : ex); return(default(ResponseType)); }