Thursday 13 May 2010

SharePoint 2010 - New Service Application - Application Pool Already Exists!


Whilst playing around with SharePoint Server 2010 there have been a number of occasions where I’ve created a new Service Application, only to find I’ve either done it wrong or need it configured in a slightly different way for whatever reason.



Typically what I’d do is delete the old SharePoint Service Application and create a fresh one. I quite often want to use the same naming convention and this seems to cause problems.



For example, I created a Secure Store Service, realised I’d done something wrong, deleted it and tried to re-create it using the same settings as before. When I try to do so, SharePoint tells me that there’s already a SharePoint IIS Application Pool (SPIisWebServiceApplicationPool) that exists with the same name:

 


 

So the first thing you think to check is IIS, right? I did that and did not see the Application Pool to delete it.


Not accepting defeat and wanting to retain my naming convention I looked into this a little further; Is SharePoint 2010 storing a list of Application Pools somewhere and not clearing them out properly?


After a little searching, it struck me that perhaps this was something I could sort out with PowerShell. Here’s how:-
I queried the list of Application Pools using Get-SPServiceApplicationPool to ensure the one I’d previously created was indeed still there and accessible to PowerShell

 


 

Then it’s as simple as calling Remove-SPServiceApplicationPool to remove it.

 


 

That's it. You've tidied up the the farm by removing the application pool and got to keep your precious naming convention. Thanks PowerShell - I'll sleep easy now.

4 comments:

  1. Remove-SPServiceApplicationPool : An object in the SharePoint administrative framework, "SPIisWebServiceApplicationPool Name=xxxxxxxxxx", could not be deleted because other objects depend on it. Update all of these dependants to point to null or different objects and retry this operation. The dependant objects are as follows:
    SPSubscriptionSettingsServiceApplication Name=xxx_xxx_xxx_ConfigurationDb_xxx
    At line:1 char:32
    + Remove-SPServiceApplicationPool <<<< $appPoolName
    + CategoryInfo : InvalidData: (Microsoft.Share...ApplicationPool:SPCmdletRemoveI...ApplicationPool) [Remove-SPServiceApplicationPool], InvalidOperationException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletRemoveIisWebServiceApplicationPool

    ReplyDelete
  2. What exactly is meant by this? It's not entirely clear...

    ReplyDelete
  3. I tried to delete the app pool with Remove-SpServiceAppication Pool "Secure store Service Pool" and then Y
    It says object reference not set to an instance of an object

    ReplyDelete
  4. Hi,

    Tried everything listed, somehow it says Object reference not set to an instance of an object.
    At line:1 Char:32

    ReplyDelete