“Microsoft.Commerce.Providers.Exceptions.ContextCreationException” error on my commerce server site

Problem:

I have deployed my sharepoint WSP on my commerce server + SharePoint site. This solution package is deployed on my two web applications and one webapplication working fine and other was broken with the following exception lot of time in event viewer:

An exception of type 'Microsoft.Commerce.Providers.Exceptions.ContextCreationException' occurred and was caught. ---------------------------------------------------------------------------------------------------------------- 10/08/2010 15:17:34 Type : Microsoft.Commerce.Providers.Exceptions.ContextCreationException, Microsoft.Commerce.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 Message : Configuration specifies useSharedCommerceContexts=true however this is only valid for a Commerce Server enabled web site runtime environment. Source : Microsoft.Commerce.Providers Help link : Data : System.Collections.ListDictionaryInternal TargetSite : Microsoft.CommerceServer.Catalog.CatalogContext get_Item(System.String) Stack Trace : at Microsoft.Commerce.Providers.ContextProviders.Shared.CatalogContextProvider.get_Item(String siteName) at Microsoft.Commerce.Providers.Metadata.CatalogMetadataProvider..ctor(String siteName) at Microsoft.Commerce.Providers.Metadata.CatalogMetadataLoader.GetSubsystemMetadata(String siteName) at Microsoft.Commerce.Providers.Metadata.SubsystemMetadataLoader.ExecuteQuery(CommerceQueryOperation queryOperation, OperationCacheDictionary operationCache, CommerceQueryOperationResponse response) at Microsoft.Commerce.Providers.Components.OperationSequenceComponent.Execute(CommerceOperation operation, OperationCacheDictionary operationCache, CommerceOperationResponse response) at Microsoft.Commerce.Broker.OperationSequence.ExecuteComponentTree(List`1 executionTreeList, CommerceOperation operation, OperationCacheDictionary operationCache, CommerceOperationResponse response) at Microsoft.Commerce.Broker.OperationSequence.Execute(CommerceOperation operation) at Microsoft.Commerce.Broker.MessageHandler.ProcessMessage(String messageHandlerName, CommerceOperation operation) at Microsoft.Commerce.Broker.OperationService.InternalProcessRequest(CommerceRequest request) at Microsoft.Commerce.Providers.Utility.CommerceEntityMetadata.ExecuteMetadataQuery(MetadataCacheKey cacheKey, String modelName) at Microsoft.Commerce.Application.Common.CachedFactory`2.GetOrCreate(TKey key, CreateInstance`2 factory) at Microsoft.Commerce.Providers.Utility.CommerceEntityMetadata.Get(String modelName, Nullable`1 commerceArea) at Microsoft.Commerce.Providers.Utility.CatalogConfigurationBuilder.GetMetadata(String modelName, EntityMapping& entityMapping, IEnumerable`1& propertyDefinitions, IEnumerable`1& definitionMappings) at Microsoft.Commerce.Providers.Utility.CatalogConfigurationBuilder.TranslatePropertyName(String modelName, String definitionName, String property) at Microsoft.Commerce.Providers.Utility.CatalogConfigurationBuilder.TranslatePropertyNames(String modelName, String definitionName, IEnumerable`1 properties) at Microsoft.Commerce.Providers.Utility.CatalogConfigurationBuilder.GetCatalogSearchOptions(CommerceSearchCriteria search, String modelName, IEnumerable`1 properties) at Microsoft.Commerce.Providers.Utility.CatalogConfigurationBuilder.GetCategoryConfiguration(CommerceQueryOperation categoryQuery) at Microsoft.Commerce.Providers.Components.CategoryPrepareQuery.ExecuteQuery(CommerceQueryOperation queryOperation, OperationCacheDictionary operationCache, CommerceQueryOperationResponse response) at Microsoft.Commerce.Providers.Components.OperationSequenceComponent.Execute(CommerceOperation operation, OperationCacheDictionary operationCache, CommerceOperationResponse response) at Microsoft.Commerce.Broker.OperationSequence.ExecuteComponentTree(List`1 executionTreeList, CommerceOperation operation, OperationCacheDictionary operationCache, CommerceOperationResponse response) at Microsoft.Commerce.Broker.OperationSequence.Execute(CommerceOperation operation) at Microsoft.Commerce.Broker.MessageHandler.ProcessMessage(String messageHandlerName, CommerceOperation operation) at Microsoft.Commerce.Broker.OperationService.InternalProcessRequest(CommerceRequest request) at Microsoft.Commerce.Broker.OperationService.ProcessRequest(CommerceRequest request) Additional Info: MachineName : <MyServerName> TimeStamp : 8.10.2010 12:17:34 FullName : Microsoft.Commerce.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 AppDomainName : /LM/W3SVC/1636174609/ROOT-1-129310138328718866 ThreadIdentity : <my username> WindowsIdentity : <my username>

Solution:

I researched a lot on net but couldn't succeed. I opened the IIS and expanded the webapplication on which I am getting an error. It found that there no commerce server specific files and folder. Like “PtipeLines” folder and “MetadataDefinitions.xml, OrderObjectMappings.xml, OrderPipelineMappings.xml, ChannelConfiguration.config” files. I put the folder and all folders in place, given the appropriate permissions. Recycled the apppool of my web application and refresh the site but couldn't succeed. Event Viewer is filled with this exception.

After I have opened the web.config file and verified. I have found that commerce server related entries in <httpModules>sections are missing. Following are the missing entries:

      <add name="CommerceApplication" type="Microsoft.CommerceServer.Runtime.CommerceApplicationModule, Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

      <add name="CommerceOrder" type="Microsoft.CommerceServer.Runtime.Orders.CommerceOrderModule, Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

      <add name="CommerceCatalog" type="Microsoft.CommerceServer.Runtime.Catalog.CommerceCatalogModule, Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

      <add name="CommerceProfile" type="Microsoft.CommerceServer.Runtime.Profiles.CommerceProfileModule, Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

      <add name="CommerceExpressionEvaluator" type="Microsoft.CommerceServer.Runtime.Targeting.CommerceExpressionModule, Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

      <add name="CommerceCache" type="Microsoft.CommerceServer.Runtime.Caching.CommerceCacheModule, Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

      <add name="CommerceContentSelection" type="Microsoft.CommerceServer.Runtime.Targeting.CommerceContentSelectionModule, Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

      <add name="CommerceDataWarehouseAuthenticationModule" type="Microsoft.CommerceServer.Runtime.CommerceDataWarehouseAuthenticationModule, Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

I have added the given entries in <httpModules> section and site is working fine and I am happy J