Example #1
0
        private Exception DoAction(Action action)
        {
            Exception result = null;

            try
            {
                SupportApiService.CheckSecurity();
                action();
            }
            catch (ADTransientException ex)
            {
                result = ex;
            }
            catch (ADExternalException ex2)
            {
                result = ex2;
            }
            catch (ADOperationException ex3)
            {
                result = ex3;
            }
            catch (AmServiceShuttingDownException ex4)
            {
                result = ex4;
            }
            catch (MapiPermanentException ex5)
            {
                result = ex5;
            }
            catch (MapiRetryableException ex6)
            {
                result = ex6;
            }
            catch (DataSourceTransientException ex7)
            {
                result = ex7;
            }
            catch (DataSourceOperationException ex8)
            {
                result = ex8;
            }
            catch (HaRpcServerBaseException ex9)
            {
                result = ex9;
            }
            catch (TransientException ex10)
            {
                result = ex10;
            }
            catch (Win32Exception ex11)
            {
                result = ex11;
            }
            catch (SecurityException ex12)
            {
                result = ex12;
            }
            return(result);
        }
Example #2
0
 public bool Start()
 {
     if (this.m_service == null)
     {
         Exception ex;
         this.m_service = SupportApiService.StartListening(out ex);
     }
     return(this.m_service != null);
 }
Example #3
0
        private static void CheckSecurity()
        {
            WindowsIdentity windowsIdentity = ServiceSecurityContext.Current.PrimaryIdentity as WindowsIdentity;

            if (windowsIdentity == null)
            {
                SupportApiService.ThrowNotAuthorized();
            }
            if (!SupportApiService.AuthorizeRequest(windowsIdentity))
            {
                SupportApiService.ThrowNotAuthorized();
            }
        }
Example #4
0
        public static SupportApiService StartListening(out Exception exception)
        {
            exception = null;
            SupportApiService supportApiService = null;

            try
            {
                supportApiService = new SupportApiService();
                int           num           = 2014;
                NetTcpBinding netTcpBinding = new NetTcpBinding();
                netTcpBinding.PortSharingEnabled = true;
                string uriString = string.Format("net.tcp://localhost:{0}/Microsoft.Exchange.HA.SupportApi", num);
                Uri    uri       = new Uri(uriString);
                supportApiService.m_host = new ServiceHost(supportApiService, new Uri[]
                {
                    uri
                });
                supportApiService.m_host.AddServiceEndpoint(typeof(IInternalSupportApi), netTcpBinding, string.Empty);
                supportApiService.m_host.Open();
                return(supportApiService);
            }
            catch (CommunicationException ex)
            {
                exception = ex;
            }
            catch (ConfigurationException ex2)
            {
                exception = ex2;
            }
            catch (InvalidOperationException ex3)
            {
                exception = ex3;
            }
            ReplayCrimsonEvents.SupportApiFailedToStart.LogPeriodic <string>(Environment.MachineName, DiagCore.DefaultEventSuppressionInterval, exception.ToString());
            if (supportApiService != null && supportApiService.m_host != null)
            {
                supportApiService.m_host.Abort();
            }
            return(null);
        }