示例#1
0
 private void TraceCasStop()
 {
     if (this.serverRequestId != Guid.Empty && ETWTrace.ShouldTraceCasStop(this.serverRequestId))
     {
         Microsoft.Exchange.Diagnostics.Trace.TraceCasStop(CasTraceEventType.AutoDiscover, this.serverRequestId, 0, 0, Query <AvailabilityQueryResult> .GetCurrentHttpRequestServerName(), TraceContext.Get(), "AutoDiscoverQuery::CompleteRequest", "emailAddresses: " + this.emailAddressesString, string.Empty);
     }
 }
示例#2
0
 private void TraceRequestStop(EmailAddress emailAddress, Guid serverRequestId)
 {
     if (ETWTrace.ShouldTraceCasStop(serverRequestId))
     {
         string spOperationData = string.Format(CultureInfo.InvariantCulture, "emailAddress: {0}", new object[]
         {
             emailAddress
         });
         Trace.TraceCasStop(CasTraceEventType.Availability, serverRequestId, 0, 0, Query <AvailabilityQueryResult> .GetCurrentHttpRequestServerName(), TraceContext.Get(), "CalendarQuery::GetCalendarData", spOperationData, string.Empty);
     }
 }
示例#3
0
 private void TraceCompleteRequest()
 {
     if (ETWTrace.ShouldTraceCasStop(this.serverRequestId))
     {
         string serverAddress;
         string clientOperation;
         this.GetUrlData(out serverAddress, out clientOperation);
         string serviceProviderOperationData = this.GetServiceProviderOperationData();
         Microsoft.Exchange.Diagnostics.Trace.TraceCasStop(CasTraceEventType.Availability, this.serverRequestId, 0, 0, serverAddress, TraceContext.Get(), "ProxyWebRequest::CompleteRequest", serviceProviderOperationData, clientOperation);
     }
     this.serverRequestId = Guid.Empty;
 }
示例#4
0
 private void TraceExecuteInternalStop(Guid serverRequestId)
 {
     if (ETWTrace.ShouldTraceCasStop(serverRequestId))
     {
         StringBuilder spExecuteOperationData = this.GetSpExecuteOperationData();
         if (string.IsNullOrEmpty(this.ServerName))
         {
             this.ServerName = Query <ReturnType> .GetCurrentHttpRequestServerName();
         }
         Microsoft.Exchange.Diagnostics.Trace.TraceCasStop(this.casTraceEventType, serverRequestId, 0, 0, this.ServerName, TraceContext.Get(), string.Format(CultureInfo.InvariantCulture, "{0}::ExecuteInternal", new object[]
         {
             base.GetType().Name
         }), spExecuteOperationData, string.Empty);
     }
 }
        internal static void TracePerformance(UserContext userContext)
        {
            OwaContext owaContext = OwaContext.Current;

            if (ETWTrace.ShouldTraceCasStop(owaContext.TraceRequestId))
            {
                string            userContext2      = string.Empty;
                HttpRequest       request           = owaContext.HttpContext.Request;
                int               totalBytes        = request.TotalBytes;
                string            pathAndQuery      = request.Url.PathAndQuery;
                ExchangePrincipal exchangePrincipal = userContext.ExchangePrincipal;
                if (exchangePrincipal != null)
                {
                    userContext2 = exchangePrincipal.MailboxInfo.DisplayName;
                }
                Trace.TraceCasStop(CasTraceEventType.Owa, owaContext.TraceRequestId, totalBytes, 0, owaContext.LocalHostName, userContext2, "OwaModule", pathAndQuery, string.Empty);
            }
        }
示例#6
0
        private void TraceExecuteFreeBusyQueryStop(Guid serverRequestId)
        {
            if (ETWTrace.ShouldTraceCasStop(serverRequestId))
            {
                base.ServerName = Query <AvailabilityQueryResult> .GetCurrentHttpRequestServerName();

                StringBuilder stringBuilder = new StringBuilder();
                if (this.desiredFreeBusyView != null)
                {
                    stringBuilder.AppendFormat("Time Window {0} to {1}; MergedFreeBusyIntervalInMinutes: {2}; RequestedView: {3}", new object[]
                    {
                        this.desiredFreeBusyView.TimeWindow.StartTime,
                        this.desiredFreeBusyView.TimeWindow.EndTime,
                        this.desiredFreeBusyView.MergedFreeBusyIntervalInMinutes,
                        this.desiredFreeBusyView.RequestedView
                    });
                }
                Microsoft.Exchange.Diagnostics.Trace.TraceCasStop(this.casTraceEventType, serverRequestId, 0, 0, base.ServerName, TraceContext.Get(), "AvailabilityQuery::ExecuteFreeBusyQuery", stringBuilder, string.Empty);
            }
        }
示例#7
0
        protected SearchResultEntryCollection GetNextResultCollection(Type controlType, out DirectoryControl responseControl)
        {
            SearchRequest searchRequest = new SearchRequest(null, this.ldapFilter, (SearchScope)this.scope, this.ldapAttributes);

            searchRequest.Controls.AddRange(this.directoryControls);
            searchRequest.SizeLimit = this.SizeLimit;
            if (this.session.ServerTimeout != null)
            {
                searchRequest.TimeLimit = this.session.ServerTimeout.Value;
            }
            SearchResponse searchResponse = null;

            responseControl = null;
            RetryManager retryManager = new RetryManager();
            ADObjectId   adobjectId   = this.rootId;
            bool         flag         = !this.session.SessionSettings.IncludeSoftDeletedObjects && !this.session.SessionSettings.IncludeInactiveMailbox && this.session.EnforceContainerizedScoping;

            for (;;)
            {
                PooledLdapConnection readConnection = this.session.GetReadConnection(this.preferredServerName, null, ref adobjectId, this.ScopeDeterminingObject);
                Guid serviceProviderRequestId       = Guid.Empty;
                try
                {
                    try
                    {
                        if (this.useNullRoot)
                        {
                            searchRequest.DistinguishedName = null;
                        }
                        else
                        {
                            searchRequest.DistinguishedName = adobjectId.ToDNString();
                            if (flag && searchRequest.Scope == SearchScope.Subtree)
                            {
                                ADObjectId domainId = adobjectId.DomainId;
                                if (domainId != null)
                                {
                                    ADObjectId childId = domainId.GetChildId("OU", "Microsoft Exchange Hosted Organizations");
                                    ADObjectId parent  = adobjectId.Parent;
                                    if (childId != null && parent != null && ADObjectId.Equals(childId, parent))
                                    {
                                        searchRequest.Scope = SearchScope.OneLevel;
                                    }
                                }
                            }
                        }
                        if (TopologyProvider.IsAdamTopology() && string.IsNullOrEmpty(searchRequest.DistinguishedName))
                        {
                            searchRequest.Controls.Add(new SearchOptionsControl(SearchOption.PhantomRoot));
                        }
                        ExTraceGlobals.ADFindTracer.TraceDebug((long)this.GetHashCode(), "ADGenericReader::GetNextResultCollection({0}) using {1} - LDAP search from {2}, scope {3}, filter {4}", new object[]
                        {
                            controlType.Name,
                            readConnection.ADServerInfo.FqdnPlusPort,
                            searchRequest.DistinguishedName,
                            (int)searchRequest.Scope,
                            searchRequest.Filter
                        });
                        serviceProviderRequestId = Trace.TraceCasStart(CasTraceEventType.ActiveDirectory);
                        searchResponse           = (SearchResponse)readConnection.SendRequest(searchRequest, LdapOperation.Search, null, this.session.ActivityScope, this.session.CallerInfo);
                        this.preferredServerName = readConnection.ServerName;
                        this.session.UpdateServerSettings(readConnection);
                        break;
                    }
                    catch (DirectoryException de)
                    {
                        if (this.customExceptionHandler != null)
                        {
                            this.customExceptionHandler(de);
                        }
                        if (readConnection.IsResultCode(de, ResultCode.NoSuchObject))
                        {
                            ExTraceGlobals.ADFindTracer.TraceWarning <string, object>((long)this.GetHashCode(), "NoSuchObject caught when searching from {0} with filter {1}", searchRequest.DistinguishedName, searchRequest.Filter);
                            return(null);
                        }
                        if (readConnection.IsResultCode(de, ResultCode.VirtualListViewError) && this.lcid != LcidMapper.DefaultLcid)
                        {
                            ExTraceGlobals.ADFindTracer.TraceWarning <int, int>((long)this.GetHashCode(), "VirtualListView error caught when performing a VLV lookup using LCID 0x{0:X}. Falling back to US English 0x{1:X}", this.lcid, LcidMapper.DefaultLcid);
                            this.RefreshSortControlWithDefaultLCID(searchRequest);
                        }
                        else
                        {
                            retryManager.Tried(readConnection.ServerName);
                            this.session.AnalyzeDirectoryError(readConnection, searchRequest, de, retryManager.TotalRetries, retryManager[readConnection.ServerName]);
                        }
                    }
                    continue;
                }
                finally
                {
                    bool isSnapshotInProgress = PerformanceContext.Current.IsSnapshotInProgress;
                    bool flag2 = ETWTrace.ShouldTraceCasStop(serviceProviderRequestId);
                    if (isSnapshotInProgress || flag2)
                    {
                        string text = string.Format(CultureInfo.InvariantCulture, "scope: {0}, filter: {1}", new object[]
                        {
                            searchRequest.Scope,
                            searchRequest.Filter
                        });
                        if (isSnapshotInProgress)
                        {
                            PerformanceContext.Current.AppendToOperations(text);
                        }
                        if (flag2)
                        {
                            Trace.TraceCasStop(CasTraceEventType.ActiveDirectory, serviceProviderRequestId, 0, 0, readConnection.ADServerInfo.FqdnPlusPort, searchRequest.DistinguishedName, "ADGenericReader::GetNextResultCollection", text, string.Empty);
                        }
                    }
                    readConnection.ReturnToPool();
                }
                break;
            }
            responseControl = this.FindControlInCollection(searchResponse.Controls, controlType);
            return(searchResponse.Entries);
        }