Category: Solution

The solution for warming up SharePoint

Most SharePoint Farms will have a solution for the long loading time after an Application Pool recycle or iisreset running. There are many different ways to preload websites, so your users have faster load times. So why another solution?

There are some questions, that I think have not been dealt with before:

  • Most solutions require some sort of Timer to be started (e.g. a Scheduled Task)
  • When should the warmup occur?
  • What about multiple WebFrontend Servers?
  • How about Claims support?
  • Which URLs have to be called? What about extended WebApplications?
  • New WebApplications require the warmup tool to be adjusted
  • Manuell warmup after Deployments
  • What about search?
  • Did the Farm warmup correctly?

Years ago I developed a console application, which warms up SharePoint by calling each Site within a SiteCollection. It has bee updated multiple times with new features.

Basis of the new solution still is the “old” application. It has been integrated into the SharePoint Central Administration and the SharePoint Timer job. That way it can be configured through an Application Page and is executed by the SharePoint Timer on each WebFrontend Server. The Solution has been tested with SharePoint 2010 and 2013.

A Custom Action displays a new link within the “Monitoring” Section of the Central Administration.

image

All WebApplications are listed, and can be configured separately. The time the Application Pools recycles is read from IIS and will be set as default time (+ 1 minute). That way you can assure fast pages even shortly after the daily recycle.

image

A manual warmup can be started through the Timerjob page, or by downloading and executing a batch file (has be be executed on each farm server).

If you select to write to the EventLog, each execution of a job will write a summary to the Application Log. If all Websites could be loaded without a problem, the Event ID will be 0. Otherwise 1.

image

The tool supports Claims WebApplications with Windows Authentication.

The download package contains two WSPs. One for a SharePoint 2010 farm, and the other for 2013.

Download: Download WSP Packages, Sources

Update November 11, 2014

  • Please restart the SharePoint Timer service on all farmservers after intalling the solution

When a Feature gets installed

Have you ever thought about the Features folder and when a folder will be created for one of you features? Well, I did 🙂

Why is this relevant, anyway? To be able to activate a feature on a given scope, it has to be installed first. That’s why.

ActionResult
stsadm -o addsolutionThe solution is added to the farm. Features are not available
stsadm -o deploysolutionFeature folders are created and the Features are available for activation
stsadm -o installfeatureA feature with ID xyz has already been installed in this farm.  Use the force attribute to explicitly re-install the feature.

Great. After deploying the solution, the feature is automatically installed and can be used. I did expect this, because installing a feature is a rather uncommon task.

Here comes another one. What if you add a feature to an existing – and deployed solution – and perform an upgrade?

ActionResult
stsadm -o upgradesolutionAdds the new feature folder
stsadm -o activatefeatureFeature with Id ‘4520d607-699b-4025-b605-5f988c97b368’ is not installed in this farm, and cannot be added to this scope.

Ups. Did you expect the result? The feature has to be installed first!

Conclusion

If you add a feature to a solution, make sure the features gets installed prior usage! There are two ways

  1. Install the new feature
  2. Retract and Redeploy the solution

Activating Features after Solution Deployment via VS

Visual Studio allow a F5 Deployment. I guess you all know that. The part where you have to think carefully is, when you add Features to your project.

Should you activate “Activate On Default”? Well, it depends (as always). Usually I don’t enable that setting, because features tend to be activated on scopes you won’t expect.

The problem

Take a WebApplication scoped feature for example. It might create SafeControl entries for your controls. Do you really want them to be added to an Extranet WebApplication if your solution is solely for an Intranet Application?

The problem does not exist for you, if you auto activate your features and have set your deployment configuration to “Default”. But in my case, I use “No Activation” and “Activate On Default = false” most of the time. Then, after you deploy an update of your solution, SharePoint retracts and re-adds the solution. The consequence is a deactivate feature 🙂 (in case of Farm and WebApplication scoped features).

My solution

CKS rocks! What’s that have to do with this?

The CKS Extensions for Visual Studio (http://cksdev.codeplex.com/) can Update the solution like you would do via PowerShell or stsadm with a new Deployment option named “Upgrade Solution (CKSDev)”.

image

Unfortunately CKS isn’t available for Visual Studio 2013 preview. So I had to do something else to avoid the problem with non activated features after deployment.

Fortunately Microsoft provided some Command Line action for post-deployment. And since the SharePoint URL is known from the properties of the project, it can be used via variable $(SharePointSiteUrl). Combined with stsadm to activate the feature, I had all I needed.

image

So for now, Deployment from VS will work again 🙂

Disable Loopback Check?

A while ago Microsoft released an update, which prevents that you can log on locally to a website which has a FQDN.

To resolve issues with e.g. the crawling a KB article has been published.

You receive error 401.1 when you browse a Web site that uses Integrated Authentication and is hosted on IIS 5.1 or a later version

You can disable the loopback check completely, or just for the used FQDNs. This would be the better way.

Manually setting the required registry entries on every SharePoint server in the farm can be a nasty task.

A better way to do so is a custom stsadm extension. Gary Lapointe has written such an extension. Take a look at it: Setting Back Connection Host Names for SharePoint 2007 Using STSADM

Quote:

You can of course do this using Group Policy but for those not managing their servers using GPO I decided to implement a custom STSADM command that would make setting the BackConnectionHostNames registry key really simple.  I called this new command, oddly enough, gl-setbackconnectionhostnames.

The following is an example of how to update the BackConnectionHostNames registry key on the current server only:

stsadm -o gl-setbackconnectionhostnames

The following is an example of how to update the BackConnectionHostNames registry key on all servers in the farm:

stsadm -o gl-setbackconnectionhostnames -updatefarm -username domain\spadmin -password pa$$w0rd

Download of the custom stsadm extension: http://stsadm.blogspot.com/2009/02/downloads.html (WSS Only STSADM Extensions (x86, x64))

Multi Level Navigation

The out-of-the-box WSS navigation offers one level of navigation. The navigation elements can be configured in the site settings.

There is a way to make it have multi level navigation, as MOSS does, by changing the DataSource. But this “hack” is not flexible, as you can not reorder the item within the navigation menu.

While I was reading the post How to create your own Cascading Navigation using the ASPMenu control, the decision was made to build a custom navigation which supports multiple navigation levels.

default WSS toplevel navigation 

configure top link bar 

 

multi level navigation I wanted a more flexible way of realizing a navigation, which allows you to have more than one level with a plain Windows SharePoint Services site. So I build a navigation control, which uses the entries of a SharePoint list as source for the navigation elements.

Of coarse multiple navigation levels are supported. You can configure a parent element for each navigation element.To customize the order of appearance, you can set the ‘Link Order’.

The feature list:

  • Custom navigation control
  • Webpart shows the navigation
  • SharePoint list as DataSource
  • Multiple navigation levels
    • Assign a parent navigation element
    • Expand navigation nodes with child elements
  • Reorder navigation elements
  • Hide navigation elements
  • Access check on relative links for web, list and items
  • Cache
    • Items from the navigation list
    • Invalidate cache if there is a change within the listitems
    • Access to navigation Urls is stored in the session
  • Import SharePoint TopLevel navigation entries to the list
  • Get navigation list items with elevated privileges, so the list can be hidden from users
  • Grouped view “By Parent” for the navigation list
  • Url Parameter
    • Refresh=true
      will force a reload of the navigation list items
    • Debug=true
      will show how long (in ms) the navigation control needs to render

Each navigation element is stored in a SharePoint list. This list is created when the feature is activated on the SiteCollection.

SharePoint list

The list can be filled with the current SharePoint navigation by clicking on the link “Import Navigation to Multi Level Navigation List” in the site settings. It brings up another page, where you can import the navigation and check for updates for the solution.

site collection administration

Installation:

  1. Add the solution with “stsadm –o addsolution –filename RH.Navigation.wsp”
  2. Deploy the solution in the Central Administration
  3. Active the feature “RH.Navigation” for a site collection
    sitecollection feature
  4. Add the Webpart to a page, or alter the masterpage to use the custom navigation instead of the build-in SharePoint navigation

Customize the masterpage

To use the Multi Level Navigation instead of the out-of-the box SharePoint navigation, register a tagprefix, add the control and remove the SharePoint Navigation.

  • Add an entry to the top of your masterpage
    <%@ Register TagPrefix="Navigation" Namespace="RH.Navigation.Control" Assembly="RH.Navigation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=2d07bbf19c37a6cf" %>
  • Alter the SharePoint navigation
    <SharePoint:AspMenuNavigation:MultiLevelNavigation
          ID="TopNavigationMenu"
          Runat="server"
          DataSourceID="topSiteMap"
          EnableViewState="false"
          AccessKey="<%$Resources:wss,navigation_accesskey%>"
          Orientation="Horizontal"
          StaticDisplayLevels="21"
          MaximumDynamicDisplayLevels="1"
          DynamicHorizontalOffset="0"
          StaticPopoutImageUrl="/_layouts/images/menudark.gif"
          StaticPopoutImageTextFormatString=""
          DynamicHoverStyle-BackColor="#CBE3F0"
          SkipLinkText=""
          StaticSubMenuIndent="0"
          CssClass="ms-topNavContainer">
            <StaticMenuStyle/>
            <StaticMenuItemStyle CssClass="ms-topnav" ItemSpacing="0px"/>
            <StaticSelectedStyle CssClass="ms-topnavselected" />
            <StaticHoverStyle CssClass="ms-topNavHover" />
            <DynamicMenuStyle  BackColor="#F2F3F4" BorderColor="#A7B4CE" BorderWidth="1px"/>
            <DynamicMenuItemStyle CssClass="ms-topNavFlyOuts"/>
            <DynamicHoverStyle CssClass="ms-topNavFlyOutsHover"/>
            <DynamicSelectedStyle CssClass="ms-topNavFlyOutsSelected"/>
        </SharePoint:AspMenuNavigation:MultiLevelNavigation>
  • OR remove the SharePoint navigation (<SharePoint:AspMenu…) and insert the MultiLevelNavigation
    <Navigation:MultiLevelNavigation runat="server"></Navigation:MultiLevelNavigation>

Note:

If your AspMenu contains the StaticDisplayLevels property, remove it or set it to 1! (Quote from MSDN: The StaticDisplayLevels property indicates how many levels to display statically from the root of the menu. For example, if StaticDisplayLevels is set to 3, your menu will be expanded to statically display its first three levels. The minimum static display level is 1, and the control will throw an exception if the value is set to 0 or a negative number.)

Download RH.Navigation.wsp

Download Sourcecode 

.NET 3.5 and Silverlight

Using AJAX or Silverlight from within SharePoint in Webparts requires you to modify the web.config to support the technology. I don’t mention that you have to install the .NET Framework 3.5 SP1 and Silverlight to be able to use it…

Instead of changing the web.config manually (.NET Framework 3.5 AJAX und Silverlight in SharePoint registrieren von Fabian Moritz), you can use my features. They do all the necessary changes for you. The Silverlight feature requires the .Net 3.5 feature.

image

Installation

  1. Add the solution to your farm “stsadm -o addsolution -filename RH.Net35WebConfig.wsp”
  2. Deploy the solution “Central Administration > Operations > Solution Management”
  3. Activate the features on a web application “Central Administration > Application Management > Manage Web Application Features”

Uninstall the solution

After you’ve deactivated the feature(s), you might get an exception (if you have set your customErrors to Off, or visit the site from your SharePoint Server):

image

This exception is thrown, because the IIS does not like the empty XML Nodes:

<system.web.extensions>
  <scripting>
    <webServices>
    </webServices>
  </scripting>
</system.web.extensions>

You can safely delete the empty nodes from your web.config.

Update 22. Aug 2009

Add section configuration/system.web/pages if it does not exist.

Download

Download RH.Net35WebConfig.wsp

Download Source RH.Net3.5WebConfig-Source

Solution deployment fails

Deploying a SharePoint solution (.wsp file) to a SharePoint farm should be easy. Even if the farm contains 4 SharePoint Servers.

Just stsadm –o addsolution –filename solution.wsp. Some waiting so the deployment is done on every server, and we should be happy.

Well, the result was an Error in the solution status. Additionally the ULS log showed

Updating SPPersistedObject SolutionOperationStatus Name=SolutionOperationStatus Parent=SPSolutionLanguagePack Name=0. Version: -1 Ensure: 0, HashCode: 38896601, Id: 87c32e71-13f0-4d85-a215-29f1d180d239, Stack:    at Microsoft.SharePoint.Administration.SPPersistedObject.Update()     at Microsoft.SharePoint.Administration.SPSolutionLanguagePack.SetOperationResult(SPSolutionOperationResult opResult, String msg, SPWebApplication webApp, Int32 updatesPerServer)     at Microsoft.SharePoint.Administration.SPSolutionLanguagePack.DeployFilesInstallFeatures(SPWebApplication webApp, Boolean globalInstallWPPackDlls, Boolean installFeatures, Boolean force, Int32 tries)     at Microsoft.SharePoint.Administration.SPSolutionLanguagePack.DeployLocalCore(Boolean globalInstallWPPackDlls, Collection`1 webAppl…

…ications, Boolean useAdminService, Boolean force)     at Microsoft.SharePoint.Administration.SPSolutionDeploymentJobDefinition.Execute(Guid targetInstanceId)     at Microsoft.SharePoint.Administration.SPTimerJobInvoke.Invoke(TimerJobExecuteData& data, Int32& result)

To get rid of the error, I went to the Timer Job definitions, and deleted the one which tried to add deploy the solution. The status went back to not deployed.

The reason for the Error was that the “Windows SharePoint Services Administration” was not stated on all SharePoint servers. After the services has been started, the deployment worked just as I expected it.

So make sure your Administration service is started, and running as System Account!

Upgrading a solution fails

In a SharePoint farm with multiple servers, features have to be deployed to every server. No problem you would think. That is why we got solutions and deploy them with stsadm. SharePoint will do the rest.

But what do you do if you got an error during the deployment process?
In my case the error was:

A deployment or retraction is already under way for the solution xyz, and only one deployment or retraction at a time is supported.

I went through the ULS logs, and found this:

The job definition "Microsoft.SharePoint.Administration.SPSolutionDeploymentJobDefinition" (id "4e323369-0cc7-4cd7-ae90-850e6706df08") requires the Administration Windows Service ("SPAdmin"), but this service is not currently running.

The entry appeared on the last server I checked…
The next steps to get the solution upgraded are:

  1. delete the deployment timer definition (Central Administration > Operations > Timer Job Definitions)
  2. upgrade the solution with stsadm –o upgradesolution

 

Technorati Tags: ,,

Installation, Deployment, Activation of Features

I get plenty of questions on how to add, deploy or activate a SharePoint Solution.

Solution

A SharePoint solution is a *.wsp file (which is a cab file) which contains at least one feature.

Feature

A feature adds new functionality to your SharePoint farm. It can be wrapped inside a solution file, or be deployed by adding files to your SharePoint servers.

Installing a Solution

To install a solution to your SharePoint farm, copy the wsp file to one of your SharePoint servers, and run "stsadm -o addsolution -filename yoursolution.wsp".

Because the installation process only includes the filename, every "-name" for updates etc. are identical to the filename. See below.

Upgrading a Solution

If you already have a solution installed and want to update it, simply update the solution with an updated wsp file and the stsadm command "stsadm -o upgradesolution -filename yoursolution.wsp -name yoursolution.wsp -immediate [-allowgacdeployment]".

You can schedule the deployment with -time instead of -immediate.

The allowgacdeployment parameter is necessary if the solution places assemblies (DLLs) into the global assembly cache (GAC).

Scopes

The scope of a feature defines on which object you can activate the feature. The scope can be "Farm", "WebApplication", "Site" or "Web".

Note from the SharePoint SDK:

For Web site scoped Features, a user must have the ManageWeb permission on the Web site to perform Feature activation or deactivation and property update through the object model or through the user interface (UI). For site collection scoped Features, a user must have the ManageWeb permission on the root Web site of the site collection to perform Feature activation or deactivation and property update through the object model, but to navigate to the Site Collection Features page and to activate or deactivate Features through the UI, the user must be a site collection administrator.

 Deployment

Before you can use a feature, you have to deploy it. If the feature was installed to your SharePoint farm, it will show up in the "Solution Management".

Clicking on a name of one solution will bring up the properties of the solution. You can see if it has been deployed and deploy it to other webapplications.

With the "Deploy Solution" Button, you can deploy the solution to one webapplication at a time.

Feature Activation

After a solution has been installed and deployed, you can activate the features containing the solution at the scope which it is designed for (see above).

Activation on Farm level

Activation on Web Application level

Make sure you choose the Web Application where you want to activate the feature!

Activation on Site Collection level

Some features require activation at the Site Collection level. This could be Webparts, which will put a .webpart file in the Webpart catalog, so you can easily add them to a page.


Activation on Web level

If the feature is designed to work on website level, you have to activate it in the "Site Administration" section of your "Site Settings".


 

I hope this post will clarify where to activate and how to install SharePoint Solutions J

Tags: SharePoint
Feature
Solution
Deployment

Many SharePoint Features

CodePlex has a project for SharePoint 2007 Features. Within this workplace there are features like:

  • Ajax Config Feature
  • Content Type Hierarchy Feature
  • Debug Config Feature
  • Debugger Feature
  • Features Source Code
  • Log Viewer Feature
  • Manage Configuration Modifications
  • Manage Form Users Feature
  • Manage Hierarchical Object Store Feature
  • Manage Layouts Site Map Feature
  • Minimal Master
  • Minimal Publishing Site
  • Placeholder Master Feature
  • Presence Contact List Feature
  • Print List Feature
  • Task Alert Feature
  • Task Mover Feature
  • Theme Changer Feature
  • Window Links Feature

Especially the Ajax Config Feature is great. In the future I will release more Webparts based on Ajax. This makes it much more easier to deploy them 🙂