none
MSBuild Community Tasks - AppPoolController

    Question

  • Has anyone been able to stop an app pool on a remote IIS server successfully with the MSBuild Community Tasks apppoolcontroller task?  I can stop it locally but not remotely following the .chm instructions.

    I am receiving the following errors:

    error : Index was outside the bounds of the array.
    error : Failed stopping application pool "xxx" on "xxx".

    I have searched some forums and googled the internet to death but there are very few posts or links about this task.

    Thanks in Advance.
    Tuesday, June 09, 2009 2:20 PM

Answers

  • I work with michael and got it fixed by adding a check in VerifyServerPortExists call

    ///

     

    <exclude/>

     

    private bool VerifyServerPortExists(DirectoryEntry site)

    {

     

    string serverBindings = site.Properties["ServerBindings"].Value.ToString();

     

    string[] serverBindingsArray = serverBindings.Split(':');

     

    if (serverBindingsArray.Length>=2 && mServerPort == Convert.ToInt32(serverBindingsArray[1]))

    {

    mServerInstance = site.Name;

    mIISServerPath =

    string.Format("IIS://{0}/W3SVC/{1}/Root", mServerName, mServerInstance);

    mIISApplicationPath =

    string.Format("/LM/W3SVC/{0}/Root", mServerInstance);

    mIISAppPoolPath =

    string.Format("IIS://{0}/W3SVC/AppPools", mServerName);

     

    return true;

    }

     

    return false;

    }

     

    Thursday, June 11, 2009 7:10 PM

All replies

  • If you are using .net 3.5, you can try the MSBuild Extension Pack . If you are stuck on 2, let me know and I'll take a look at the community code.

    Mike
    Tuesday, June 09, 2009 3:25 PM
  • Unfortunately, this is for the 2.0 framework. 
    Tuesday, June 09, 2009 6:25 PM
  • I managed to get it to work using

     <AppPoolController ApplicationPoolName="AnAppPool" Action="Restart" ServerName="MyServer"/>

    I don't need security credentials in my scenario. Note the documentation is wrong for the task, the property is ApplicationPoolName, not AppPoolName.

    Can you provide your sample and full log. I used the latest nightly build. not sure if / when it was ever updated.

    Mike
    Wednesday, June 10, 2009 7:48 AM
  • Tried that with the same result:

    Project "D:\Apps\CruiseControl.NET\server_ProviderCheckAmounts\PCA_TEST.proj" (default targets):

    Target Compile:
        Building ProviderCheckAmounts solution...
    Target AfterBuild:
        D:\Apps\CruiseControl.NET\server_ProviderCheckAmounts\PCA_TEST.proj(48,3): error : Index was outside the bounds of the array.
        D:\Apps\CruiseControl.NET\server_ProviderCheckAmounts\PCA_TEST.proj(48,3): error : Failed stopping application pool "ProviderCheckAmounts" on "ProviderCheckAmounts".
    Done building target "AfterBuild" in project "PCA_TEST.proj" -- FAILED.

    What seems strange is that it is trying to stop the app pool on the app pool instead of the server.

    I am using the latest nightly build tasks.  In addition, the service account has admin rights to the build machine and web server.

    <Target Name="AfterBuild" DependsOnTargets="Compile">

      <AppPoolController ApplicationPoolName="ProviderCheckAmounts" Action="Stop" ServerName="AUSPORTTW01" />

    Wednesday, June 10, 2009 7:50 PM
  • Ignore the message, its just a bug in the task

                    Log.LogError("Failed {0} application pool \"{1}\" on \"{1 }\".", GetActionInProgress(), ApplicationPoolName, ServerName);

    I think your best bet will be to download the code and step into the debugger. I suspect it's failing in the VerifyIISRoot() call.

    Regards

    Mike

    Thursday, June 11, 2009 8:06 AM
  • I work with michael and got it fixed by adding a check in VerifyServerPortExists call

    ///

     

    <exclude/>

     

    private bool VerifyServerPortExists(DirectoryEntry site)

    {

     

    string serverBindings = site.Properties["ServerBindings"].Value.ToString();

     

    string[] serverBindingsArray = serverBindings.Split(':');

     

    if (serverBindingsArray.Length>=2 && mServerPort == Convert.ToInt32(serverBindingsArray[1]))

    {

    mServerInstance = site.Name;

    mIISServerPath =

    string.Format("IIS://{0}/W3SVC/{1}/Root", mServerName, mServerInstance);

    mIISApplicationPath =

    string.Format("/LM/W3SVC/{0}/Root", mServerInstance);

    mIISAppPoolPath =

    string.Format("IIS://{0}/W3SVC/AppPools", mServerName);

     

    return true;

    }

     

    return false;

    }

     

    Thursday, June 11, 2009 7:10 PM