SPS 2013 Error connecting to subsite - An unexpected error has occurred

 

When we try to access subsite "https://testesite/xxxx/xxxxx/xxxxxx/" we get unexpected error

 

When we try to Stsadm –o Deactivatefeature   -name  navigation [-url] <URL name> sites loads fine.

 

03/18/2013 15:47:12.28 w3wp.exe (0x15D0) 0x21E0 Web Content Management Publishing 8vzf High PortalSiteMapProvider was unable to fetch children for node at URL: /sites/########/######, message: Thread was being aborted., stack trace:    at Microsoft.SharePoint.Library.SPRequestInternalClass.MoveNavigationNode(String bstrUrl, Int32 lNodeId, DateTime dateParented, Int32 lParentId, Int32 lPreviousSiblingId)     at Microsoft.SharePoint.Library.SPRequest.MoveNavigationNode(String bstrUrl, Int32 lNodeId, DateTime dateParented, Int32 lParentId, Int32 lPreviousSiblingId)     at Microsoft.SharePoint.Navigation.SPNavigationNode.MoveInternal(SPNavigationNodeCollection collection, Int32 iPreviousNodeId)     at Microsoft.SharePoint.Publishing.Navigation.SPNavigationSiteMapNode.UpdateSPNavigationNode(SPNavigationNode node, SPNavigationNode previous, String name, String url, String description, String target, String audience, Boolean forceCreate)     at Microsoft.SharePoint.Publishing.Navigation.SPNavigationSiteMapNode.UpgradeDraftSPNavigationNode(SPNavigationNode draftNode, SPNavigationNode previous)     at Microsoft.SharePoint.Publishing.Navigation.PortalWebSiteMapNode.<>c__DisplayClass3.<UpdateNavigationNodes>b__1()     at Microsoft.Office.Server.Utilities.Security.SecurityUtilities.RunWithAllowUnsafeUpdates(SPWeb web, Action secureCode)     at Microsoft.SharePoint.Publishing.Navigation.PortalWebSiteMapNode.PopulateNavigationChildrenInner(NodeTypes includedTypes)     at Microsoft.SharePoint.Publishing.Navigation.PortalWebSiteMapNode.PopulateNavigationChildren(NodeTypes includedTypes)     at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapNode.GetNavigationChildren(NodeTypes includedTypes, NodeTypes includedHiddenTypes, Boolean trimmingEnabled, OrderingMethod ordering, AutomaticSortingMethod method, Boolean ascending, Int32 lcid)     at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapNode.GetNavigationChildren(NodeTypes includedTypes, NodeTypes includedHiddenTypes, OrderingMethod ordering, AutomaticSortingMethod method, Boolean ascending, Int32 lcid)     at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapNode.GetNavigationChildren(NodeTypes includedHiddenTypes)     at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider.GetChildNodes(PortalSiteMapNode node, NodeTypes includedHiddenTypes) 5a13099c-b15e-d07b-31a8-15db5146af27

03/18/2013 15:47:12.28 w3wp.exe (0x15D0) 0x21E0 SharePoint Foundation Stack Trace Collection 0000 Verbose Returning hr=0x8107140D: owssvr.dll: (unresolved symbol, module offset=00000000000DA765) at 0x000007FEEB33A765 Microsoft.SharePoint.Library.ni.dll: (unresolved symbol, module offset=0000000000108B37) at 0x000007FEEC5D8B37 5a13099c-b15e-d07b-31a8-15db5146af27

03/18/2013 15:47:12.28 w3wp.exe (0x15D0) 0x21E0 SharePoint Foundation General 8kh7 High An unexpected error occurred while manipulating the navigational structure of this Web. 5a13099c-b15e-d07b-31a8-15db5146af27

 

 

 

 

Ran following PowerShell script.

param

(

   $url = $(Read-Host -Prompt "SiteCollection Url")

)

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$Logfile = "duplicates_log.txt"

Function LogWrite

{

  Param ([string]$logstring)

  Add-content $Logfile -value $logstring

}

function tryDeleteNode

{

   param

   (

       $node,$dictionary,$nodeCollection

   )

   $title = $node.Title

                   if(!$dictionary.ContainsKey($title))

                   {

                       $dictionary.Add($node.Title,$node.Url)

                   }

                   else

                   {

                       if($dictionary[$title] -eq $node.Url)

                       {

                           if($node.Children.Count -eq 0)

                           {

                               echo "       -> Deleting Duplicate Node: $title"

                               $nodeCollection.Delete($node)

                               $global:didDelete= $true

                                              $temp = (get-date).ToString() +";"+ ($site.Url) +";"+ ($title)

                                              echo "$temp"

                                              LogWrite $($temp)

                           }

                           else

                           {

                               echo "       -> Dupe Node $title has children, Skipping..."

                           }

                       }

               else

                       {

                   echo "       -> Duplicate title $title found, but mismatched link, Skipping..."

                       }

                   }

}

function deleteNodesRecurse

{

   $nodes = @{}

   foreach($node in $quickLaunch)

   {

       $childNodes = @{}

       foreach($child in $node.Children)

       {

           tryDeleteNode -node $child -dictionary $childNodes -nodeCollection $node.Children

       }

       tryDeleteNode -node $node -dictionary $nodes -nodeCollection $quickLaunch

   }

}

function deleteGlobalNodesRecurse

{

   $nodes = @{}

   foreach($node in $gnavNodes)

   {

       $childNodes = @{}

       foreach($child in $node.Children)

       {

           tryDeleteNode -node $child -dictionary $childNodes -nodeCollection $node.Children

       }

       tryDeleteNode -node $node -dictionary $nodes -nodeCollection $gnavNodes

   }

}

$sitecoll = Get-SPSite $url

write-host "SiteCollection: " $sitecoll.URL

foreach ($site in $sitecoll.AllWebs)

{

       write-host " -> Site: " $site.URL

               do

               {

                              $quickLaunch = $site.Navigation.QuickLaunch

                              $global:didDelete = $false

                              deleteNodesRecurse

                              $pub= [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($site)

                              $gnavNodes = $pub.Navigation.GlobalNavigationNodes;

                              deleteGlobalNodesRecurse

               }

               while($global:didDelete)

               $site.Dispose()

}

$sitecoll.Dispose()