コード例 #1
0
        public StartApplicationRequestResponse StartApplication(StartApplicationRequest request)
        {
            CheckNumberOfApplications();
            CheckMemoryAvailable();

            try
            {
                OperationContext operationContext = OperationContext.Current;
                // 5 minute timeout, mostly for debugging.
                operationContext.Channel.OperationTimeout = TimeSpan.FromMinutes(5);

                Application application = Application.Start(request);

                //TODO: when we start allowing application recovery, remove these lines.
                // NOTE: These events are fired only if the underlying connection is permanent (eg, duplex http or net tcp).

                // Commented out per CR 3/22/2011, don't want the contenxt to reference the application
                //operationContext.Channel.Closed += delegate { application.Stop(); };
                //operationContext.Channel.Faulted += delegate { application.Stop(); };

                return(new StartApplicationRequestResponse {
                    AppIdentifier = application.Identifier
                });
            }
            catch (Enterprise.Common.InvalidUserSessionException ex)
            {
                throw new FaultException <SessionValidationFault>(new SessionValidationFault {
                    ErrorMessage = ExceptionTranslator.Translate(ex)
                });
            }
            catch (Enterprise.Common.PasswordExpiredException ex)
            {
                throw new FaultException <SessionValidationFault>(new SessionValidationFault {
                    ErrorMessage = ExceptionTranslator.Translate(ex)
                });
            }
            catch (Enterprise.Common.UserAccessDeniedException ex)
            {
                throw new FaultException <SessionValidationFault>(new SessionValidationFault {
                    ErrorMessage = ExceptionTranslator.Translate(ex)
                });
            }
            catch (Enterprise.Common.RequestValidationException ex)
            {
                throw new FaultException <SessionValidationFault>(new SessionValidationFault {
                    ErrorMessage = ExceptionTranslator.Translate(ex)
                });
            }
            catch (Exception ex)
            {
                throw new FaultException(ExceptionTranslator.Translate(ex));
            }
        }
コード例 #2
0
        public void StopApplication(StopApplicationRequest request)
        {
            try
            {
                IApplication application = FindApplication(request.ApplicationId);

                Platform.Log(LogLevel.Info, "Received application shutdown request from {0}", GetClientAddress());

                application.Shutdown();
            }
            catch (Exception ex)
            {
                throw new FaultException(ExceptionTranslator.Translate(ex));
            }
        }
コード例 #3
0
        public ProcessMessagesResult ProcessMessages(MessageSet messageSet)
        {
            IApplication application = FindApplication(messageSet.ApplicationId);

            if (application == null)
            {
                return(null);
            }

            try
            {
                return(application.ProcessMessages(messageSet));
            }
            catch (Enterprise.Common.InvalidUserSessionException ex)
            {
                Platform.Log(LogLevel.Error, ex, "Error has occurred in ProcessMessages");
                throw new FaultException <SessionValidationFault>(new SessionValidationFault {
                    ErrorMessage = ExceptionTranslator.Translate(ex)
                });
            }
            catch (Enterprise.Common.PasswordExpiredException ex)
            {
                Platform.Log(LogLevel.Error, ex, "Error has occurred in ProcessMessages");
                throw new FaultException <SessionValidationFault>(new SessionValidationFault {
                    ErrorMessage = ExceptionTranslator.Translate(ex)
                });
            }
            catch (Enterprise.Common.UserAccessDeniedException ex)
            {
                Platform.Log(LogLevel.Error, ex, "Error has occurred in ProcessMessages");
                throw new FaultException <SessionValidationFault>(new SessionValidationFault {
                    ErrorMessage = ExceptionTranslator.Translate(ex)
                });
            }
            catch (Enterprise.Common.RequestValidationException ex)
            {
                Platform.Log(LogLevel.Error, ex, "Error has occurred in ProcessMessages");
                throw new FaultException <SessionValidationFault>(new SessionValidationFault {
                    ErrorMessage = ExceptionTranslator.Translate(ex)
                });
            }
            catch (Exception ex)
            {
                Platform.Log(LogLevel.Error, ex, "Error has occurred in ProcessMessages");
                throw new FaultException(ExceptionTranslator.Translate(ex));
            }
        }
コード例 #4
0
 internal void Stop(Exception e)
 {
     Platform.Log(LogLevel.Error, e, "An error has occurred and the application is stopping");
     Stop(ExceptionTranslator.Translate(e));
 }