Monday, November 8, 2010

Commerce Server Template Pack for SharePoint 2010

At our User Group meeting last week, I installed the Template Pack live on a SharePoint 2010 installation. Several asked to have the procedure I used, so here goes.

The main point with the template pack is that it works with CS2009, you do not have to wait for R2.

1. First you will need a functioning SharePoint 2010 installation. This has quite a high Hardware Spec, with 64 bit and 8 GB. I did my Hyper V installation with 4 GB, but I am not recommending this. If you are using virtual images you will need a separate machine as a domain controller. Yes, I know you there are other options, hacking SharePoint (for local accounts) or hacking Commerce Server (so that you can install on a domain controller) but the whole point is to have a supported installation.

2. Second you will need to go through the usual fun process: Install Commerce Server 2007, Configure, Install Commerce Server 2009, Configure. Make sure you have everything you need (eg. Business Tools) otherwise you will have to uninstall CS2009, to get these. I usually unpup rather than use a CS project, so I have no VS2005/2008/2010 problems here. You of course will need the 64 bit version of the cab file:
CSRedistW2k3EN64.cab
If you are installing on W2008 R2 as I was you will get an error that Net 3.5 SP1 is not installed, even if it is automatically installed as part of W2008 R2. Installing will of course give the error that it is already installed. The only way out of this infinite loop is hotfix KB 975567, the hotfix was filed under Vista, but worked fine.

3. Now is a good time to switch User Account Control off. I have my reservations about this step, but it is in black and white in the Template Pack installation instructions. I leave it to you if you do it with the UI or Group Policy, I preferred the registry entry setting key HKLM\Software\Microsoft\Windows\ CurrentVersion\Policies\System\
EnableLUA to 0
Then install the Template Pack.

4. Next you should create your web app and extend it. You can use the SharePoint Commerce Services Wizard for this, I preferred to do this with SharePoint central admin. Add your host headers to DNS.

5. Now create your Commerce Server site. I unpacked the DefaultSiteWithData and made sure I named the site ContemporarySite. The reasons for doing this step manually are because of the next step. Make sure that all accounts have the rights in SQL they need.

6. If you run the SharePoint Commerce Services Wizard now (with Windows 2008 R2), the Wizard will fail with an error creating the Profile encryption key. I suspect this is because Windows 2008 R2 restricts Registry entries, perhaps things will be better after W2008R2 Sp1.
So with thanks to Ravi Kanth's blog, you will have to run
ProfileKeyManager.exe /kn /O (Note: Ravi has a typo here, it should not be a zero.)
ProfileKeyManager /ke /kf "NewKeyPair_2010_9_15_20_46_14_35.xml" /reg "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Commerce Server 2007 Keys\ContemporarySite"
(you will have to adjust the key file name to match the autogenerated name from the first command.)

7. Now you can run the SharePoint Commerce Services Wizard and select the web app you have created and the Commerce Server site you created. Press View Site and ....

8. You should have the Contemporary Site coming up, obviously the Channel needs to be set.
Careful, you cannot run the Wizard twice, without getting an DLL open error. The product team says that you can fix this by retracting and removing the solution before running again, makes sense to me. But some claim the only way to fix this is to run reflector and skip one line.
According to the product team there is another known issue on CS default zone with SP2010 if an IIS Hotfix (KB979917) is installed (which is recommended by SP2010). The workaround is to change the AllowAnonymousImpersonation value from default value “true” to “false”
Don't forget, there is a new extensibility kit that comes with the template pack, you will need to use this one if you are changing web parts.

9. If you open the Forms authenticated site in your browser you will get the unusually helpful message in your error log:
Object Cache: The super reader account utilized by the cache does not have sufficient permissions to SharePoint databases.
To configure the account use the following command 'stsadm -o setproperty -propertyname portalsuperreaderaccount -propertyvalue account -url webappurl'. It should be configured to be an account that has Read access to the SharePoint databases.
Additional Data:
Current default super reader account: NT AUTHORITY\LOCAL SERVICE

This is because this claims authentication does not resolve this account. To fix, use the stsadm command as they suggest to set the portalsuperreaderaccount to an appropriate domain account

Caveat: Obviously you should read and follow the entire Template pack installation instructions, especially if doing a production installation. There are more hotfixes needed for production, but this quick guide should get you going with a working installation. As with any technical procedure, there are bound to be mistakes in my write up, please let me know, so I can correct them.