Commerce Server Blog

Build world class ecommerce applications using Microsoft Commerce Server
  •  
  • Home
  • Advertise
  • Copyright Policy
  • Disclaimer
  • About

“Object reference not set to an instance of an object” – while accessing commerce server profile subsystem.

ravikanth | June 7, 2008

Whenever you are trying to create a new user profile using Commerce Server SDK as shown below, it throws an error – “Object reference not set to an instance of an object”.

ProfileContext profiles= CommerceContext.Current.ProfileSystem;

You may face similar type of error when web.config is missing some of the HTTP modules which are responsible for populating commerce server context. A standard application includes following HTTP modules.

CommerceApplication
CommerceAuthentication
CommerceOrder
CommerceCatalog
CommerceProfile
CommerceExpressionEvaluator
CommerceCache
CommerceContentSelection
CommerceDataWarehouseAuthenticationModule 

If you are developing commerce server site from beginning, you can refer to the following Microsoft material which describes the configuration settings of commerce server web.config application.

http://msdn.microsoft.com/en-us/library/ms960520.aspx

If you wish to know how to make it work, you need to ensure the following codes  in commerce server application web.config file.

<configSections>
    <sectionGroup name=”CommerceServer”>
      <section name=”application” type=”Microsoft.CommerceServer.Runtime.Configuration.CommerceApplicationSectionHandler, Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>
      <section name=”authentication” type=”Microsoft.CommerceServer.Runtime.Configuration.CommerceAuthenticationSectionHandler, Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>
      <section name=”pipelines” type=”Microsoft.CommerceServer.Runtime.Configuration.CommercePipelineSectionHandler, Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>
      <section name=”caches” type=”Microsoft.CommerceServer.Runtime.Configuration.CommerceCacheSectionHandler, Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>
      <section name=”messageManager” type=”Microsoft.CommerceServer.Runtime.Configuration.CommerceMessageManagerSectionHandler, Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>
      <section name=”catalog” type=”Microsoft.CommerceServer.Runtime.Configuration.CommerceCatalogSectionHandler, Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>
      <section name=”orders” type=”Microsoft.CommerceServer.Runtime.Configuration.CommerceOrdersSectionHandler, Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>
      <section name=”profiles” type=”Microsoft.CommerceServer.Runtime.Configuration.CommerceProfilesSectionHandler, Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>
      <section name=”contentSelection” type=”Microsoft.CommerceServer.Runtime.Configuration.CommerceContentSelectionSectionHandler, Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>
      <section name=”commerceEvent” type=”Microsoft.CommerceServer.Runtime.Configuration.EventLoggerConfigurationHandler, Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>
      <section name=”expressions” type=”Microsoft.CommerceServer.Runtime.Configuration.CommerceExpressionSectionHandler, Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>
    </sectionGroup>
  </configSections>
  <!–  COMMERCE SERVER CONFIGURATION SECTION
  This signifies the beginning of the configuration of the Commerce Server .NET
  Application Framework.
 –>
  <CommerceServer>
    <application siteName=”EShop” debugLevel=”Checked”/>
  </CommerceServer>
  <appSettings/>
 <connectionStrings/>
 <system.web>
    <httpModules>
         <add name=”CommerceApplication” type=”Microsoft.CommerceServer.Runtime.CommerceApplicationModule, Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>
      <add name=”CommerceAuthentication” type=”Microsoft.CommerceServer.Runtime.CommerceAuthenticationModule, 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″/>
    </httpModules></system.web>  

Categories
Troubleshoot, commerce server 2007
Comments rss
Comments rss
Trackback
Trackback

« Microsoft Commerce Server 2007 SP2 Quick Order Implementation in Commerce Server 2007 »

Leave a Reply

Click here to cancel reply.

Powered by WP Hashcash

Sign up for Newsletter


Categories

Quiz

  • Catalog Quiz for Beginners
  • Profile Quiz for Beginners
  • Quiz 1 for Advance Users
  • Quiz for Beginners

Recent Posts

  • RCXml2Resx.exe tool stops working
  • Commerce Server Profile Importer Tool
  • Marketing Web service Exception: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM
  • Download Commerce Server 2009 Help Document
  • Commerce Server 2009 work with SharePoint 2010?
  • Failed to set value for profile property ‘email_address’.
  • ArgumentException: An item with the same key has already been added.
  • Please note that one or more items were removed from your order because the product is no longer sold.
  • How to Avoid Duplicate Orders Numbers in Commerce Server
  • Error: Microsoft.Commerce.Contracts.Faults.ItemDoesNotExistFault

Archives

  • July 2010
  • June 2010
  • May 2010
  • April 2010
  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • September 2009
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • September 2008
  • August 2008
  • July 2008
  • June 2008
  • May 2008
  • April 2008

Tags

add discounts add images to profile Advantages of commerce server approve discounts authentication auto login process automatic user creation basket Brand Management business tools campaign management Catalog catalog import Category CategoryConfiguration commerce server commerce server 2007 commerce server manager Commerce Server SP2 discounts ecommerce Estimation Installation inventory Kanth Koppala marketing system migration error Mojave operation components operation sequence Order subsystem Product profile profile subsystem property metadata purchase order quick checkout Ravi Ravi Kanth site cache refresh starter site tools transactions error Variant
(c) 2009 Commerce Server Blog. All rights Reserved. Articles cannot be reproduced without permission from the author.Write to me at kanth@ravikanth.net if you have any comments, questions, suggestions about this site or would like to send us a tip
About Us | Terms of Use | Disclaimer | Advertise .