/// <summary>
 /// Constructs a websites list command
 /// </summary>
 internal WebsiteChangeStateCommand(Website site, WebsiteState state)
 {
     HttpVerb = HttpVerbPut;
     ServiceType = "services";
     OperationId = "webspaces";
     // keep this in to ensure no 403
     HttpCommand = String.Format("{0}/sites/{1}", site.Webspace, site.Name);
     Site = site;
     State = state;
 }
Exemple #2
0
        public static int StopService()
        {
            Log.Write(TraceEventType.Information, "Stop Service");

            if (IISHosted)
            {
                WebSite site = GetInstallWebSite();
                if (site != null)
                {
                    WebsiteState state = IISHelper.StopWebSite(site.Name);
                    switch (state)
                    {
                    case WebsiteState.Stopped:
                        return(1);

                    case WebsiteState.Started:
                        return(4);

                    default:
                        return(0);
                    }
                }
                return(0);
            }
            else
            {
                try
                {
                    System.ServiceProcess.ServiceController sc = new System.ServiceProcess.ServiceController("Workshare Compare Service");
                    sc.Stop();
                    sc.WaitForStatus(System.ServiceProcess.ServiceControllerStatus.Stopped);

                    return((int)sc.Status);
                }
                catch (Exception ex)
                {
                    Log.Write(TraceEventType.Error, "{0}", ex);
                    return(GetServiceStatus());
                }
            }
        }
        public void MyTestInitialize()
        {
            this.target = new DataLogics();

            this.websiteCountry = new WebsiteCountry {
                Abbreviation = "OH", FullName = "Ohio", Id = 1
            };
            this.websiteState = new WebsiteState {
                Id = 1, Name = "OH"
            };
            this.websiteCounty = new WebsiteCounty {
                Id = 1, Name = "test"
            };
            this.websiteCategory = new ProviderServiceCategory
            {
                Active      = true,
                Name        = "Test",
                ID          = 1,
                Description = "this is a test",
                Crime       = false
            };
        }
 private void ChangeWebsiteState(string name, string webspace, WebsiteState state)
 {
     WebsiteManagementClient.WebSites.Update(webspace, name, new WebSiteUpdateParameters
     {
         State = state.ToString(),
         // Set the following 3 collection properties to null since by default they are empty lists,
         // which will clear the corresponding settings of the web site, thus results in a 404 when browsing the web site.
         HostNames = null,
         HostNameSslStates = null,
     });
 }
 private void ChangeWebsiteState(string name, string webspace, WebsiteState state)
 {
     Site siteUpdate = new Site { Name = name, State = state.ToString() };
     WebsiteChannel.UpdateSite(subscriptionId, webspace, name, siteUpdate);
 }
 private void ChangeWebsiteState(string name, string webspace, WebsiteState state)
 {
     WebsiteManagementClient.WebSites.Update(webspace, name, new WebSiteUpdateParameters
     {
         State = state == WebsiteState.Running ? WebSiteState.Running : WebSiteState.Stopped
     });
 }