public ActionResult EnableTraffic(string serviceUrlPrefix, bool enabled) { ServiceManager manager = new ServiceManager(); manager.UpdateHostedServiceStatus(serviceUrlPrefix, enabled); return this.RedirectToAction("Index"); }
public ActionResult Index() { string serviceUrlPrefix = CloudConfigurationManager.GetSetting("HostedServiceUrlPrefix"); ServiceManager manager = new ServiceManager(); bool appIsOnline = manager.GetHostedServiceStatus(serviceUrlPrefix); if (!appIsOnline) { Response.Close(); } return new EmptyResult(); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) => { configSetter(RoleEnvironment.GetConfigurationSettingValue(configName)); }); HttpContext.Current = null; ServiceManager manager = new ServiceManager(); string serviceRegion = RoleEnvironment.GetConfigurationSettingValue("HostedServiceRegion"); string serviceUrlPrefix = RoleEnvironment.GetConfigurationSettingValue("HostedServiceUrlPrefix"); manager.InitializeHostedServiceStatus(serviceRegion, serviceUrlPrefix); }
public ActionResult Index() { CloudServiceViewModel model = new CloudServiceViewModel() { HttpHost = Request["HTTP_HOST"], ClientIPAddress = Request.UserHostAddress, ClientHostName = Request.UserHostName, ServerName = Request["SERVER_NAME"], CurrentRegion = RoleEnvironment.GetConfigurationSettingValue("HostedServiceRegion"), DnsTtl = RoleEnvironment.GetConfigurationSettingValue("DnsTtl") }; ServiceManager manager = new ServiceManager(); foreach (var service in manager.GetHostedServiceStatus()) { model.HostedServices.Add(service.RowKey, service); } return this.View(model); }