Tuesday, October 22, 2013

SharePoint Disable Loopback Check


שלום חברים,

לאחרונה, בסיום הקמת חוות SharePoint אני עובד על שרת ואני מנסה לגשת לאתר SharePoint מקומי, כל הזמן אני מתבקש להכניס שם משתמש וסיסמה וזה קצת מעצבן :) .

זה "תכונה" בשרת שצריך להשבית כדרך לעקיפת הבעיה.
 התכונה מונעת גישה ליישום אינטרנט באמצעות שם תחום מלא.
אם הניסיון לגשת אליו (ליישום אינטרנט ) מתקיים ממכונה שמארחת יישום זה.

התוצאה הסופית היא גישה 401.1 נדחתה מהשרת האינטרנט וכשל בכניסה ביומן האירועים.

יש כמה שיטות לעשות את זה אני אבחר לבטל את סימון הלולאה החוזרת - DisableLoopbackCheck.
יש צורך ליצור מפתח רישום DWORD שנקראDisableLoopbackCheck ולהגדיר אותו עם הערך 1.

בצע את הפעולות הבאות:
לחץ על התחל, לחץ על הפעלה, הקלד regedit ולאחר מכן לחץ על אישור בעורך רישום, אתר את מפתח הרישום הבא: HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ Lsa לחץ לחיצה ימנית Lsa, הצבע על חדש, ולאחר מכן לחץ על ערך DWORD. DisableLoopbackCheck סוג, ולאחר מכן לחץ על ENTER. DisableLoopbackCheck לחץ לחיצה ימנית ולאחר מכן לחץ על שנה. בתיבה הנתונה הערך, הקלד 1 ולאחר מכן לחץ על אישור. צא מעורך רישום. ייתכן שתצטרך להפעיל מחדש את השרת שלך.


בהצלחה !
רון נס.


============================================================================================================================================================================================================================================================


Hello Friends,

Recently, I was working on a server and we were trying to access the local SharePoint site and I was constantly prompted for the username and password. In SharePoint 2010 and SharePoint 2013, it can really annoy.

It is a ‘feature’ on the server that you need to disable as a workaround.
The feature prevents access to a web application using a fully qualified domain name.
if an attempt to access it takes place from a machine that hosts that application.

The end result is a 401.1 Access Denied from the web server and a logon failure in the event log.

There are some methods to do this I Choose to Disable the loopback check – DisableLoopbackCheck.
You would need to create a DWORD registry key in the registry called DisableLoopbackCheck and set it to 1. 

Follow these steps:
Add this registry entry manually
Click Start, click Run, type regedit, and then click OK In Registry Editor, locate the following registry key:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa Right-click Lsa, point to New, and then click DWORD Value. Type DisableLoopbackCheck, and then press ENTER. Right-click DisableLoopbackCheck, and then click Modify. In the Value data box, type 1 and then click OK. Quit Registry Editor. You may need to restart your server.


Good Luck :)
Ron Ness.

Thursday, October 17, 2013

SharePoint 2010 : Issue got introduced since August 2012 CU

שלום חברים
היום חקרתי בעיות עומס וביצועים, בזמן שאנשים מנסים לנווט לדף הבית באתר שלהם.
לאחר שעמוד חדש פובלש זמני טעינת האתר התחילו לגדול באופן דרמטי או לחילופין בקשות דפים לא סיימו את הטעינה בכלל. אתם תראו "שגיאה צפויה אירעה" הידועה לשמצה.

תוכלו לראות שגיאות ביומן ULS לאחר שמשתמש פרסם דף ולאחר מכן מנסה לפתוח את הדף:

" System.Data.SqlClient.SqlException: Transaction (Process ID 76) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.  
 at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)  
 at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)   
 at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)  
 at System.Data.SqlClient.SqlDataReader.HasMoreRows()  
 at System.Data.SqlClient.SqlDataReader.ReadInternal(Boolean setTimeout)  
 at Microsoft.SharePoint.SPSqlClient.ExecuteQueryInternal(Boolean retryfordeadlock)  
 at Microsoft.SharePoint.SPSqlClient.ExecuteQuery(Boolean retryfordeadlock)


Unexpected query execution failure in navigation query, HResult -2146232060. Query text (if available): "BEGIN TRAN DECLARE @abort int SET @abort = 0 DECLARE @EidBase int,@EidHome int SET @EidBase = 0 SET @EidHome = NULL IF @abort = 0 BEGIN EXEC @abort = proc_GetWebNavStructNodeByIds '1CA27B52-5021-4CE1-AE8A-C553F62481C5','26F979ED-9769-4F91-B29C-CC45C798D393',13730 SELECT @wssp0 = @abort END IF @abort <> 0 BEGIN ROLLBACK TRAN END ELSE BEGIN COMMIT TRAN END IF @abort = 0 BEGIN EXEC proc_UpdateDiskUsed '1CA27B52-5021-4CE1-AE8A-C553F62481C5' END "


An unexpected error occurred while manipulating the navigational structure of this Web.


Leaving Monitored Scope (PortalSiteMapNode: Populating navigation children for web: /ABCDEF). Execution Time=66179.2079302278

PortalSiteMapProvider was unable to fetch children for node
at URL: /ABCDEF, message: An unexpected error occurred while manipulating the navigational structure of this Web., stack trace: 
 at Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx)  
 at Microsoft.SharePoint.Library.SPRequest.UpdateNavigationNode(String bstrUrl, Int32 lNodeId, DateTime dateParented, String bstrName, String bstrNodeUrl, Object& pvarProperties, String& pbstrDateModified)  
 at Microsoft.SharePoint.Navigation.SPNavigationNode.Update()  
 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__DisplayClass2.<UpdateNavigationNodes>b__0()  
 at Microsoft.Office.Server.Utilities.Security.SecurityUtilities.RunWithAllowUnsafeUpdates(SPWeb web, Action secureCode)  
 at Microsoft.SharePoint.Publishing.CmsSecurityUtilities.RunWithAllowUnsafeUpdates(SPWeb web, CodeToRun 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) "

עם העדכונים של אפריל 2013 CU או כל CU אחרי אפריל 2013 (Service Pack 2. וכו ') ניתן לפתור בעיה זו. ניתן להוריד CU + SP2 מכאן

לאחר התקנת העדכון שך אפריל 2013 CU או כל CU אחרי אפריל 2013 תצטרכו להריץ את הקוד הזה ב- Management Shell של SharePoint :
# Set the Problematic Site Collection
#-----------------------------------------------------
param($url = $(Read-Host -Prompt "SiteCollection Url"))      # Change the Value between the quotes

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue


# Log Function
#--------------------
$Logfile = "C:\duplicates_log.txt"

Function LogWrite
{
   Param ([string]$logstring)

   Add-content $Logfile -value $logstring
}



# Utility Functions
#---------------------------
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
    }
}


# The Program Start Here !
#-------------------------------------
$sitecoll = Get-SPSite $url
write-host "SiteCollection: " $sitecoll.URL -foregroundcolor Yellow
foreach ($site in $sitecoll.AllWebs)
{
        write-host " -> Site: " $site.URL -foregroundcolor Green
                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()


זהו זה, סיימתם !


בהצלחה !
רון נס.

============================================================================================================================================================================================================================================================



Hello Friends
Today I was asked to explore Load and Performance Problems, It's when people are trying to Navigate to the Home Page in their site.

After publishing a new page the site load times start to increase dramatically or page requests don’t finish loading at all. You will see the infamous “An expected error has occurred“-error or if the callstack is enabled and custom errors are turned off in the web.config (CallStack="true" / customErrors mode="Off") you will see a "Request timed out." error-message.

Errors you will see in the ULS log after a user has published a page and then tries to open the page / site containing the page:


" System.Data.SqlClient.SqlException: Transaction (Process ID 76) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.  
 at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)  
 at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)   
 at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)  
 at System.Data.SqlClient.SqlDataReader.HasMoreRows()  
 at System.Data.SqlClient.SqlDataReader.ReadInternal(Boolean setTimeout)  
 at Microsoft.SharePoint.SPSqlClient.ExecuteQueryInternal(Boolean retryfordeadlock)  
 at Microsoft.SharePoint.SPSqlClient.ExecuteQuery(Boolean retryfordeadlock)


Unexpected query execution failure in navigation query, HResult -2146232060. Query text (if available): "BEGIN TRAN DECLARE @abort int SET @abort = 0 DECLARE @EidBase int,@EidHome int SET @EidBase = 0 SET @EidHome = NULL IF @abort = 0 BEGIN EXEC @abort = proc_GetWebNavStructNodeByIds '1CA27B52-5021-4CE1-AE8A-C553F62481C5','26F979ED-9769-4F91-B29C-CC45C798D393',13730 SELECT @wssp0 = @abort END IF @abort <> 0 BEGIN ROLLBACK TRAN END ELSE BEGIN COMMIT TRAN END IF @abort = 0 BEGIN EXEC proc_UpdateDiskUsed '1CA27B52-5021-4CE1-AE8A-C553F62481C5' END "


An unexpected error occurred while manipulating the navigational structure of this Web.


Leaving Monitored Scope (PortalSiteMapNode: Populating navigation children for web: /ABCDEF). Execution Time=66179.2079302278

PortalSiteMapProvider was unable to fetch children for node
at URL: /ABCDEF, message: An unexpected error occurred while manipulating the navigational structure of this Web., stack trace: 
 at Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx)  
 at Microsoft.SharePoint.Library.SPRequest.UpdateNavigationNode(String bstrUrl, Int32 lNodeId, DateTime dateParented, String bstrName, String bstrNodeUrl, Object& pvarProperties, String& pbstrDateModified)  
 at Microsoft.SharePoint.Navigation.SPNavigationNode.Update()  
 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__DisplayClass2.<UpdateNavigationNodes>b__0()  
 at Microsoft.Office.Server.Utilities.Security.SecurityUtilities.RunWithAllowUnsafeUpdates(SPWeb web, Action secureCode)  
 at Microsoft.SharePoint.Publishing.CmsSecurityUtilities.RunWithAllowUnsafeUpdates(SPWeb web, CodeToRun 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) "



With  April 2013 CU or any of CU after April 2013 (Service Pack 2 .etc) it is now possible to fix this issue. You can download CU + sp2 from here

After you Install April 2013 CU or any of CU after April 2013 you will need to rum this code:

# Set the Problematic Site Collection
#-----------------------------------------------------
param($url = $(Read-Host -Prompt "SiteCollection Url"))      # Change the Value between the quotes

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue


# Log Function
#--------------------
$Logfile = "C:\duplicates_log.txt"

Function LogWrite
{
   Param ([string]$logstring)

   Add-content $Logfile -value $logstring
}



# Utility Functions
#---------------------------
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
    }
}


# The Program Start Here !
#-------------------------------------
$sitecoll = Get-SPSite $url
write-host "SiteCollection: " $sitecoll.URL -foregroundcolor Yellow
foreach ($site in $sitecoll.AllWebs)
{
        write-host " -> Site: " $site.URL -foregroundcolor Green
                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()

And that's it!, your Done.

Good Luck :)
Ron Ness.