none
Unable to delete web application - sharepoint administrative framework error

    Question

  • All,

     

    I have a web application - no site collections, no content databases.

    I've tried time and time again to delete it and every time I receive the following error in Central Admin:

     

    An object in the SharePoint administrative framework, "SPWebApplication Name=SharePoint - Estate Portal Parent=SPWebService", 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:
       at Microsoft.SharePoint.Administration.SPConfigurationDatabase.DeleteObject(Guid id)
       at Microsoft.SharePoint.Administration.SPConfigurationDatabase.DeleteObject(SPPersistedObject obj)
       at Microsoft.SharePoint.Administration.SPPersistedObject.Delete()
       at Microsoft.SharePoint.Administration.SPWebApplication.Delete()
       at Microsoft.SharePoint.ApplicationPages.DeleteWebApplicationPage.BtnSubmit_Click(Object sender, EventArgs e)
       at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
       at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
       at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

     

    I also get this logged in Event Viewer on the WFE:

    Log Name:      Application
    Source:        Windows SharePoint Services 3
    Date:          08/07/2011 14:15:35
    Event ID:      5586
    Task Category: Database
    Level:         Error
    Keywords:      Classic
    User:          N/A
    Computer:     
    Description:
    Unknown SQL Exception 547 occured. Additional error information from SQL Server is included below.

    The DELETE statement conflicted with the REFERENCE constraint "FK_SiteMap_Application". The conflict occurred in database "SharePoint_Config", table "dbo.SiteMap", column 'ApplicationId'.
    The statement has been terminated.

     

    I have so far, tried:

    Removing it via Central Admin

    Removing it via STSADM

    Associating it with a different SSP than all the other Web apps

    Re-creating a new site collection and content DB for it, and then re-deleting it

    Restarting the Timer service

     

     

    I guess I just don't understand what it is that's preventing the deletion? Clearly there is something somewhere that depends on this web app - so that's why it can't be deleted, but how can I identify it?

     

    Thanks in advance

    Duncan

     

    Friday, July 08, 2011 1:23 PM

All replies

  • Hi Duncan,

    Very odd issue...just curious whehter you tried to run PSCONFIG wizard and see if there were any update pending at the database level?

    Probably worth a try.

    Thank you!


    BlueSky2010
    Friday, July 08, 2011 7:11 PM
  • Can you confirm that no modification was done to SP databases manually? It seems that there is a duplicate webapplication ID in siteMap table for this. You can run a select query on config database's siteMap table to find that out.
    Saturday, July 09, 2011 5:16 AM
  • Hi Duncan ,

     

    You can check if there are any solutions deployed on the web application or any timer jobs on the web application .

    1.       Go to Central Administration>Operations>Solution Management .Here you can check whether there are any solutions deployed on the web application.

    2.       Go to Central Administration>Operations>Timer Job Definitions .To see if there are any timer jobs on the web application .

     

    For more information, please refer to this site:

    Cannot delete web application: http://www.surfray.com/ontolica/178-cannot-delete-web-application.html

     

    Thanks,


    Entan Ming
    Tuesday, July 12, 2011 5:32 AM
    Moderator
  • Hi All

     

    Thanks very much for your replies to date.

    BlueSky2010 - Can you please provide me with the appropriate command so I can use PSCONFIG to check for pending updates?

    Soumyadev - I can confirm NO updates or changes to the DB have been made, assuming there is a duplicate entry in the DB for it, I'm very hesitant to delete the entry or change the DB

    Entan Ming - I've checked all Timer jobs - nothing, and the solution list contains mostly solutions that have been "Globally Deployed", and s few that have been deployed to specific web applications (though none of them are the "problem" web app).

    Thanks

     

    Duncan

    Tuesday, July 12, 2011 8:13 AM
  • Hi ,

     

    Have you tried to extend the web application to another IIS website from Central Administration -> Application Management -> Create or Extend Web Application -> Extend Web Application to another IIS Web Site ? The above process adds a new content db with the web application  . And then try deleting the old web application .Will it work now?

     

    Or try  to create a new config db using SharePoint Products and Technologies Configuration Wizard. Then delete the web application .

     

    Thanks,


    Entan Ming
    Thursday, July 14, 2011 9:13 AM
    Moderator
  • Hi Entan

     

    Ok, this is what I did:

    Extended the Web app to the Internet Zone - succesfully done (although oddly it returned me back to the Central Admin homepage, when it normally sends you to a screen where it asks you to create a Site Collection...?)

    Anyway, the newly extended site is visible in IIS.

    Attempted to delete the original web app but it still fails:

    An object in the SharePoint administrative framework, "SPWebApplication Name=SharePoint - Estate Portal Parent=SPWebService", 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:
       at Microsoft.SharePoint.Administration.SPConfigurationDatabase.DeleteObject(Guid id)
       at Microsoft.SharePoint.Administration.SPConfigurationDatabase.DeleteObject(SPPersistedObject obj)
       at Microsoft.SharePoint.Administration.SPPersistedObject.Delete()
       at Microsoft.SharePoint.Administration.SPWebApplication.Delete()
       at Microsoft.SharePoint.ApplicationPages.DeleteWebApplicationPage.BtnSubmit_Click(Object sender, EventArgs e)
       at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
       at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
       at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

     

     

    Regarding creating a new Config database, I'm nervous about doing this at a farm level, as all the other web apps are working perfectly?

    Duncan

    Thursday, July 14, 2011 9:25 AM
  • Ok - so an update everyone,

    I managed to remove IIS from both the Intranet and Internet Zones for this Web App, and I can confirm it has no Content DB associated with it.

    I've also confirmed that there are no Timer Jobs waiting for it, and there are no deployed features to it.

    Is this looking like an edit of the config Database? I realise this isn't supported (and completely agree as to WHY!) but I'm not sure there are many options left.

    Is there are Query I can run aganist the DB that might show what the problem is? There seems to be a concensus that there may be a duplicate Web App ID in the "SiteMap" table - any suggestions on how to proceed?

    Thanks

     

    Duncan


    Friday, July 15, 2011 9:08 AM
  • Very strange.... I have the exact same issue right now with one of my Web Applications.

    • All content databases are removed
    • All Zones are removed
    • All custom solutions are retracted and uninstalled

    Not sure what is holding onto the web application.

    This is the event viewer error:

    Unknown SQL Exception 547 occurred. Additional error information from SQL Server is included below.
    The DELETE statement conflicted with the REFERENCE constraint "FK_SiteMap_Application". The conflict occurred in database "SharePoint_Config", table "dbo.SiteMap", column 'ApplicationId'.
    The statement has been terminated.

    this is the powershell output:

    Remove-SPWebApplication : An object in the SharePoint administrative framework,
     "SPWebApplication Name=SharePoint - 80", could not be deleted because other ob
    jects depend on it. Update all of these dependants to point to null or differe
    nt objects and retry this operation. The dependant objects are as follows:
    At line:1 char:24
    + Remove-SPWebApplication <<<< -Identity http://pigpen
      + CategoryInfo     : InvalidData: (Microsoft.Share...PWebApplication:
      SPCmdletRemoveSPWebApplication) [Remove-SPWebApplication], InvalidOperatio
     nException
      + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletRemoveSP
      WebApplication
    

    Any thoughts as to what is going on?

    Saturday, July 16, 2011 3:07 AM
  • Okay, I was able to delete the Web Application by manually deleting rows in the database...

    Now I know I violated all warranties -but manually deleting two rows in the SiteMap table using SQL Server Management Studio solved my issue. Luckily, this is a development SharePoint system and have no real "support" to worry about.

    Not sure how SharePoint got into this state. In any event, once the two orphaned rows were deleted -I was able to remove the Web Application via Central Administration.

    Hope this helps someone,

    Dan

    Saturday, July 16, 2011 3:42 AM
  • Hi Duncan,

    Try to run psconfig on your farm, then clear sharepoint cache and restart timer services on all servers in your farm and then try removing webapp. Follow the steps written here http://technet.microsoft.com/en-us/library/cc288561(office.12).aspx

    Running select SQL query with nolock attribute on your sharepoint database is supported, but msft doesn't support a SP database where insert/update/delete statement is fired without MSFT engineers knowledge. I strictly recomend not to run any such SQL statement on SP database, but a select query would be ok to execute. You will find all web application entries in objects table under config DB.

    Thanks,

    Soumyadev

    Sunday, July 17, 2011 6:01 PM
  • I have the same issue on a 2010 installation any further thoughts. There is a 2010 forum post stating the same thing http://social.technet.microsoft.com/Forums/da/sharepoint2010setup/thread/e07b1230-207e-4b91-9a8b-5e199c58c2f9

    I would suspect that it is the same resolution, but I don't see any resolutions yet. Thoughts?

    Eric

    • Proposed as answer by IamDreaMinG Friday, August 04, 2017 8:07 AM
    Tuesday, May 01, 2012 5:19 PM
  • Hi Daniel,

    I had the same issue and I use the below command to delete the orphan content database that was producing the issue:

    STSADM -O deleteconfigurationobject -id {ContentDatabaseID column in SiteMap table}

    This will avoid leave orphan objects in the Objects table and not void the warranty.

    Regards,

    Javier

    
    
    
    • Proposed as answer by Rosendo Suva Friday, December 28, 2012 10:49 AM
    Monday, July 23, 2012 3:22 AM
  • Hi Duncan,

    I had exactly the same issue on my SharePoint 2010 test environment.  I resolved the issue by deleting the orphan database for the web application using the STSADM command below :

    STSADM -O deleteconfigurationobject -id {DatabaseID column in SiteMap table}

    The correct DatabaseID for your web application to use in the command above can be found from the SharePoint Config's siteMap table under the DatabaseID column.

    Regards,

    RSuva


    • Edited by Rosendo Suva Friday, December 28, 2012 11:11 AM Typo
    Friday, December 28, 2012 11:10 AM
  • I got the same error. To resolve this we did the following.

    Step 1: Run the following SQL on the sharepoint configuration database of your farm.

    select * from Objects (nolock) where Name like '%<name of the webapplication>%'

    Step 2: This will return all the objects associated with the webapplication

    a) ContentDatabase

    b) Site Collection

    Step 3: Use the application id and run the following statement on the sitemap table on the sharepoint configuration database.

    select * from SiteMap (nolock) where ApplicationId = '<Id from the above step>'

    Step 4: Deleted the site collections using the following command.

    stsadm -o deletesite -force -siteid "<GUID of the site>" -databaseserver "DB ServerName" -databasename "ContentDatabase name"

    Ref: http://technet.microsoft.com/en-us/library/cc288016.aspx

    Thanks

    Joe

    • Proposed as answer by aeonian Monday, June 03, 2013 7:21 AM
    • Unproposed as answer by Steven AndrewsEditor Wednesday, June 05, 2013 9:42 AM
    Monday, June 03, 2013 6:57 AM
  • Thanks Rosendo, I know this is an old post but this just got me out of a hole too.. Thanks...

    Phil

    Sunday, October 05, 2014 2:09 PM
  • Hi Phil, good to hear that you solved your issue by following my suggested instruction. Thanks for the feedback, I hope others can solve their similar issue by using the same.

    RE:

    Hi Duncan,

    I had exactly the same issue on my SharePoint 2010 test environment.  I resolved the issue by deleting the orphan database for the web application using the STSADM command below :

    STSADM -O deleteconfigurationobject -id {DatabaseID column in SiteMap table}

    The correct DatabaseID for your web application to use in the command above can be found from the SharePoint Config's siteMap table under the DatabaseID column.

    Regards,

    RSuva

    Regards,

    Rosendo

    Monday, December 01, 2014 2:10 AM
  • Just wanted to confirm this procedure worked to solve the same issue for me in SharePoint 2013.  I had this error: "The DELETE statement conflicted with the REFERENCE constraint "FK_SiteMap_Application". The conflict occurred in database "SharePoint_Config", table "dbo.SiteMap", column 'ApplicationId'."

    The following procedure, combined from above steps, worked to clear it... after performing these steps I was able to delete the web application.

    In SQL Server Management Studio:

    -- Change database to your SharePoint config db.

    select * from Objects (nolock) where Name like '%<name of web app>%'
    --Copy the ID column value; this is the ApplicationId

    select * from SiteMap (nolock) where ApplicationId = '<application id from previous query>'
    --Copy the DatabaseID column value

    In a Windows CMD window:

    STSADM -O deleteconfigurationobject -id <DatabaseID from previous query>

    Never would have figured this out without this thread, thanks all!!


    MCS Sr Consultant

    Monday, December 22, 2014 4:43 PM
  • Ran into similar issue on Sharepoint 2016 environment when tried to delete Webapplication. Was working on test environment and tried to delete WepApp using account which donot has enough permissions , it failed to delete site which was  expected , however when tried to do same with admin account ran into this issue 

    Solution I used :

    Using Sharepoint 2016 Management Shell

     1. Get-SPDatabase - Will give list of all databases in farm ( Name | ID | Type)

     2.$db=Get-SPDatabase | where-object {$_.id -eq 'GUID of database need to be deleted'}

     3. $db.Delete

     4. Delete Webapplication by UI 

    Hope this helps 


    • Proposed as answer by Jim Ehrenberg Thursday, July 13, 2017 7:07 PM
    Tuesday, October 04, 2016 6:54 PM