none
Difference between pause and stop buttons inside website edit form? RRS feed

  • General discussion

  • Hello,

    can someone tell me difference between pause and stop buttons in website edit form? I've tried to check this on my own but both actions are doing the same.

    Regards

    Monday, January 3, 2011 5:23 PM

All replies

  • I guess "pause" means the process is still running (although not displaying website) while "stop" means process is stopped completely in IIS/Windows services.
    Thursday, January 6, 2011 1:31 PM
  • I've digged into the code to find how this is handled and it looks like there is no difference at all between those buttons:

        public void ChangeSiteState(string siteId, ServerState state)
        {
          using (var srvman = GetServerManager())
          {
            var webSite = srvman.Sites[siteId];
            //
            if (webSite == null)
              return;
            //
            switch (state)
            {
              case ServerState.Continuing:
              case ServerState.Started:
                webSite.Start();
                webSite.ServerAutoStart = true;
                break;
              case ServerState.Stopped:
              case ServerState.Paused:
                webSite.Stop();
                webSite.ServerAutoStart = false;
                break;
            }
            //
            srvman.CommitChanges();
          }
        }
    
    As you can see Stopped and Paused are being handled by the same command. In my opinion we could replace pause button to recycle app function. Someone interested?

    Sunday, January 9, 2011 6:35 PM
  • I've made very nasty hack but it works and I think it can be added to WSP sources. Modified files:

    WebsitePanel Server:

    WebObjectsModuleService.cs method public void ChangeSiteState(string siteId, ServerState state) I've added additional case:

     

              case ServerState.Recycling:
                srvman.ApplicationPools[srvman.Sites[siteId].Applications[0].ApplicationPoolName].Recycle();
                break;
    

     

    WebsitePanel Portal:

    WebSitesEditSite.ascx

    I've replaced Pause button to Recycle. From:

    <asp:ImageButton ID="cmdPause" runat="server" SkinID="PauseMedium" meta:resourcekey="cmdPause" CommandName="Paused" OnClick="cmdChangeState_Click" />
    

    to:

    <asp:ImageButton ID="cmdPause" runat="server" SkinID="PauseMedium" meta:resourcekey="cmdPause" CommandName="Recycling" OnClick="cmdChangeState_Click" />
    

    WebSitesEditSite.ascx.cs

    I've modified a little method protected void cmdChangeState_Click(object sender, ImageClickEventArgs e) and replaced:

    BindSiteState(state);
    

    to:

            if (state != ServerState.Recycling)
            {
              BindSiteState(state);
            }
            else
            {
              BindSiteState(ServerState.Started);
            }
    

    I had to do this because IIS has no IIS state called Recycling and since recycling is only allowed when website is running then I'm passing ServerState.Started when Recycling is runned.

    That's all. I thought it will be harder.

    I hope someone can look at this:

    srvman.ApplicationPools[srvman.Sites[siteId].Applications[0].ApplicationPoolName].Recycle();

    I'm not sure is passing 0 index for Applications will work always correctly.

    Sunday, January 9, 2011 8:51 PM
  • One more thing. You have to edit ServerState.cs file inside WebsitePanel Server and add "Recycling = 8" to ServerState enum.
    Sunday, January 9, 2011 8:54 PM
  • As per IIS design the difference between the Pause and Stop buttons are that if you click Pause the IIS stops accepting new connections for the specific web site, but continues serving already established connections. If you click Stop the corresponding process is stopped and all current connections and processes are terminated.

    Not sure what WSP does, but ideally it should mimic the IIS original behavior.


    Regards, jegor.
    Monday, January 10, 2011 3:03 PM
  • Hello,

    where I can find Pause button in IIS (7.0) Manager? As far I can see there is only Stop/Start/Restart or Recycle.

    Monday, January 10, 2011 4:53 PM
  • Hello,

    where I can find Pause button in IIS (7.0) Manager? As far I can see there is only Stop/Start/Restart or Recycle.


    Hm... In IIS6 it is right-click on the web site and Pause, not sure about IIS7/7.5. If it is not there so we can remove the Pause button then for IIS7/7.5 provider.

    Regards, jegor.
    Thursday, January 13, 2011 1:37 AM
  • Nope. I don't see Pause button in IIS 7.5
    Thursday, January 13, 2011 8:47 AM
  • This is my updated case switch responsible for recycling and starting app pool if it was stopped by IIS (in this case user has not possibility to start app pool because he can control only website state):

              case ServerState.Recycling:
                var appPool = srvman.ApplicationPools[webSite.Applications["/"].ApplicationPoolName];
                if (appPool.State == ObjectState.Stopped)
                {
                  appPool.Start();
                }
                else
                {
                  appPool.Recycle();
                }
                break;
    

    Monday, June 20, 2011 9:05 AM
  • Hi there folks,

    Would you mind if I move the thread into "WebsitePanel - Discussions" forum as the question it is getting mixed with the code? :-)


    Please vote, if you find a post helpful! Appreciate.
    Monday, June 20, 2011 6:42 PM
  • I think you can move it to Development
    Monday, June 20, 2011 8:16 PM
  • Sure, I will.

    Please vote, if you find a post helpful! Appreciate.
    Monday, June 20, 2011 9:41 PM

  • We edited the portal, ES and Server methods to do this. Guess no need to post our modifications since you have this :)

        public virtual void RecycleAppPool(string siteId)
        {
          ManagementObject objSite = wmi.GetObject(String.Format("IIsWebServer='{0}'", siteId));
          objSite.InvokeMethod("Recycle", null);
        }

    I have not tested this with IIS6, but I believe it should work.

    Saturday, July 30, 2011 7:38 PM
  • My solution works only for IIS7 and I only edited WSP Server to make it working :) (and template in WSP Portal from CommandName="Paused" to CommandName="Recycling"). I've made also new icon for this action:

    http://imageshack.us/photo/my-images/40/recycle24.png/

    Sunday, July 31, 2011 3:39 PM