Commerce Server 20072009 Invalid class string after moving the resource Databases to a Production Server.

I’ve seen this issue a number of times on customer systems so I thought I would blog about it.

 

When restoring existing Commerce Server 2009 or 2007  resource databases onto a new SQL Server you may see errors when connecting to the site.
These errors are related to being unable to connect to the Profiles System.
Exception Details: System.Runtime.InteropServices .CoMException: Invalid class string

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can

be identified using the exception stack trace below.

Stack Trace:

[COMException (0x800401f3): Invalid class string

]

Microsoft.CommerceServer.Interop.Profiles.ProfileServiceClass.Initialize(String sConfigStore, String sCatalog) -s-O

Microsoft.CommerceServer.Runtime.Profiles.ProfileContext. .ctor(String profileServiceConnectionString, String providerConnectionString, String bdaoConnectionString, DebugContex

[CommerceProfileSystemException: Failed to initialize profile service handle.]

Microsoft.CommerceServer.Runtime.Profiles.ProfileContext. .ctor(String profileServiceConnectionString, String providerConnectionString, String bdaoConnectionString, DebugContex

Microsoft.CommerceServer.Runtime.CommerceContextFactory.CreateProfileContext() t608

frhcrosoft.CommerceServer.Runtime.CommerceContextFactory.get_ProfileContextSinqleton() -s-82

Microsoft.CommerceServer.Runtime.Profiles.CommerceProfileModule.CreateProfileContext() t5

Microsoft.CommerceServer.Runtime.Profiles.CommerceProfileModule.get_ModuleProfileContext() +96

Microsoft.CommerceServer.Runtime.Profiles.CommerceProfileModule.OnBeginRequest(Object sender, EventArgs e) t25

System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +128

System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) t76

Issue Cause
This issue is caused by the fact that the Profile Resource Connection Strings are held in the MSCS_Admin database.
Most people will change these settings in Commerce Server Manager and this will ensure that the Profiles resource is pointing to the correct database.
However the Profiles Data Source connection String is held in the Profiles Database in the SourceDef table.
This is not changed via the Resource Connection strings and can lead to the above error.

Issue Resolution
To resolve this error you will need to follow these steps.
1) Restore the Databases.

2) Open Commerce Server Manager.

3) Expand the Global Resource tree.

4) Find the Global Resource for your Profiles Resource.

5) Right click and choose Properties.

6) Ensure that the 3 connection strings are pointing to the right database server and database.
clip_image002

7) Click on Ok to return to Commerce Server Manager.
8) Under the Profiles resource expand the Profile Catalog tree.

9) Then expand the Data Sources tree.

10) Right click on the ProfileService_SQLSource and choose properties.

11) Switch to the Partitions Tab.

12) Select the Partition and click on edit. (You should have only one entry in here but we do support multiple partitions.)
13) Then on the Partition Properties dialog you can click on Edit to modify this connection string.
clip_image004