-1

This is the error code in full:

[2013-03-20 15:34:52,901] Sync3DCartDatabase.ConfigHandler - System.NullReferenceException: Object reference not set to an instance of an object. at Sync3DCartDatabase.ConfigHandler.Create(Object parent, Object configContext, XmlNode section)

[ERROR] [2013-03-20 15:34:52,917] ASP.syncdatabase_aspx - System.NullReferenceException: Object reference not set to an instance of an object. at Sync3DCartDatabase.SyncDatabase.SyncDatabaseFromFile()

Below is part of the code where it looks like it is referencing. I can post the whole code if required.

    <?xml version="1.0"?>

    <!--
     For more information on how to configure your ASP.NET application, please visit
     http://go.microsoft.com/fwlink/?LinkId=169433
     -->

    <configuration>
     <configSections>
     <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
     <sectionGroup name="SyncServiceConfigSection">
     <section name="ServiceConfig" type="Sync3DCartDatabase.ConfigHandler, Sync3DCartDatabase" />
     </sectionGroup>
     </configSections>
     <log4net>
     <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
     <file value="logfile.txt" />
     <appendToFile value="true" />
     <rollingStyle value="Size" />
     <maxSizeRollBackups value="5" />
     <maximumFileSize value="1MB" />
     <staticLogFileName value="true" />
     <layout type="log4net.Layout.PatternLayout">
     <conversionPattern value="[%level] [%date] %logger - %message%newline" />
     </layout>
     </appender>
     <root>
     <level value="INFO" />
     <appender-ref ref="RollingFileAppender" />
     </root>
     </log4net>
     <SyncServiceConfigSection>
     <ServiceConfig>
     <!--Time Interval after which to Sync Database (in secs)-->
     <SyncInterval>2700</SyncInterval> 
     <!--Path where working files will be placed-->
     <WorkingFolder>FTPHelperFolder</WorkingFolder>
     <SourceFolderPath>/wwwroot/flatfile</SourceFolderPath>
     <CartConnectionInfo>
     <StoreUrl>Store URL Here</StoreUrl>
     <UserKey>API Key Here</UserKey>
     </CartConnectionInfo>
     <!--FTP Machine information to connect-->
     <FTPSessionOptionInfo>
     <HostName>FTP Host Here</HostName>
     <PortNumber>-1</PortNumber>
     <UserName>FTP User</UserName>
     <Password>FTP Pass</Password>
     <!--FTP = 0, SFTP = 1-->
     <FTPProtocol>0</FTPProtocol>
     <SshHostKeyFingerprint></SshHostKeyFingerprint>
     <!-- None = 0, Implicit = 1, ExplicitSsl = 2, ExplicitTls = 3-->
     <FTPSecure>0</FTPSecure>
     <SslHostCertificateFingerprint>SSL Finger</SslHostCertificateFingerprint>
     </FTPSessionOptionInfo>
     <MappedFileDetails>
     <MappedFileDetails>
     <FileInfo fileNameSuffix="P" fileNamePattern="yyyyMMdd" fileExtension=".txt" >
     <!-- Delete the file after it has been successfully updated to 3D cart-->
     <!-- 0= Do Not Delete / 1 = Delete-->
     <DeleteFTPFileAfterSync>0</DeleteFTPFileAfterSync>
     <!--Mapping for input and output column names-->
     <ColumnsMappingDetails>
     <ColumnsMappingDetails>
     <column name="SKU" mappedName="id" update="0" insert="1" ColumnType="2"></column>
     <column name="STATUS 0=ACTIVE/9=INACTIVE" mappedName="hide" update="0" ColumnType="3" insert="0">
     <!--Mapping for input to output column values-->
     <MappedValues>
     <value origValue="0" mappedValue="0"></value>
     <value origValue="9" mappedValue="1"></value>
     </MappedValues>
     </column>
     <column name="QTY AVAILABLE" mappedName="Stock" update="0" insert="0" ColumnType="1"></column>
     <column name="STYLE" mappedName="mfgid" update="0" insert="0" ColumnType="2"></column>
     <column name="SUGG PRICE" mappedName="price2" update="0" insert="0" ColumnType="1"></column>
     <column name="PRICE" mappedName="price" update="1" insert="1" ColumnType="4"></column>
     <column name="ADVERTIZED PRICE" mappedName="saleprice" update="1" insert="1" ColumnType="4"></column>
     </ColumnsMappingDetails>
     </ColumnsMappingDetails>
     </FileInfo>
     <FileInfo fileNameSuffix="S" fileNamePattern="yyyyMMdd" fileExtension=".txt" >
     <!-- Delete the file after it has been successfully updated to 3D cart-->
     <!-- 0= Do Not Delete / 1 = Delete-->
     <DeleteFTPFileAfterSync>0</DeleteFTPFileAfterSync>
     <!--Mapping for input and output column names-->
     <ColumnsMappingDetails>
     <ColumnsMappingDetails>
     <column name="SKU" mappedName="id" update="0" insert="1" ColumnType="2"></column>
     <column name=" SET PRICE" mappedName="price" update="1" insert="1" ColumnType="4"></column>
     <column name="ADVERTIZED SET PRICE" mappedName="saleprice" update="1" insert="1" ColumnType="4"></column>
     </ColumnsMappingDetails>
     </ColumnsMappingDetails>
     </FileInfo>
     </MappedFileDetails>
     </MappedFileDetails>
     </ServiceConfig>
     </SyncServiceConfigSection>
     <system.web>
     <compilation debug="true" targetFramework="4.0" />
        <customErrors mode="Off"/>
     <authentication mode="Forms">
     <forms loginUrl="~/Account/Login.aspx" timeout="2880" />
     </authentication>

     <membership>
     <providers>
     <clear/>
     <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices"
     enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
     maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
     applicationName="/" />
     </providers>
     </membership>

     <profile>
     <providers>
     <clear/>
     <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
     </providers>
     </profile>

     <roleManager enabled="false">
     <providers>
     <clear/>
     <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
     <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
     </providers>
     </roleManager>

     </system.web>

     <system.webServer>
     <modules runAllManagedModulesForAllRequests="true"/>
     </system.webServer>
     <system.serviceModel>
     <bindings>
     <basicHttpBinding>
     <binding name="cartAPISoap" />
     <binding name="cartAPIAdvancedSoap" />
     </basicHttpBinding>
     </bindings>
     <client>
     <endpoint address="http://api.3dcart.com/cart_advanced.asmx"
     binding="basicHttpBinding" bindingConfiguration="cartAPISoap"
     contract="cartAPI.cartAPISoap" name="cartAPISoap" />
     <endpoint address="http://api.3dcart.com/cart_advanced.asmx"
     binding="basicHttpBinding" bindingConfiguration="cartAPIAdvancedSoap"
     contract="cartAPI.cartAPIAdvancedSoap" name="cartAPIAdvancedSoap" />
     </client>
     </system.serviceModel>
    </configuration>
p.s.w.g
  • 146,324
  • 30
  • 291
  • 331
  • 1
    Welcome to Stack Overflow! Almost all cases of `NullReferenceException` are the same. Please see "[What is a NullReferenceException in .NET?](http://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-in-net)" for some hints. – John Saunders Mar 20 '13 at 21:58

1 Answers1

0

Add a break point in SyncDatabaseFromFile(). Step through and find where you reference an object that hasn't been initialized with the new() paramater.

Also, learn to ask better questions. This is extremely vague

  • Sorry about that, I forgot to put spaces for the code to show. I have not found any line for SyncDatabaseFromFile(). It looks like that command was never used. – user2192882 Mar 20 '13 at 22:06