-1

这是完整的错误代码:

[2013-03-20 15:34:52,901] Sync3DCartDatabase.ConfigHandler - System.NullReferenceException:对象引用未设置为对象的实例。在 Sync3DCartDatabase.ConfigHandler.Create(对象父,对象 configContext,XmlNode 部分)

[错误] [2013-03-20 15:34:52,917] ASP.syncdatabase_aspx - System.NullReferenceException:对象引用未设置为对象的实例。在 Sync3DCartDatabase.SyncDatabase.SyncDatabaseFromFile()

下面是看起来正在引用的代码的一部分。如果需要,我可以发布整个代码。

    <?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>
4

1 回答 1

0

在 SyncDatabaseFromFile() 中添加断点。逐步检查并找到您引用尚未使用 new() 参数初始化的对象的位置。

另外,学会提出更好的问题。这是非常模糊的

于 2013-03-20T21:52:29.693 回答