2.0 Beta - Object reference not set to an instance of an object.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
I'm baffled.

I'm using 3 machines (development desktop, sql server, IIS 7 server) all in the same local network to test this.

I downloaded 2.0 Beta, loaded it on VS2010, compiled it and ran it on my developement desktop. This all works. nopCommerce started and did its installation process and created the database on my remote database server. Next, I removed the database to start fresh. Then I published nopCommerce on my remote IIS Server. This all works fine.

Other than the canonical path, there should be no difference running nopCommerce from my desktop vs the IIS server.

When I brought up IE from my development desktop to view nopCommerce, I expect it to go through the installation process and then show me the home page. It did the installation process, created the database but then, it gets a null reference exception:

------------------------------- error message --------------------------------------------

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 10: @Html.Action("HomepageProducts", "Catalog")

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
   Nop.Services.Tax.TaxService.GetTaxRate(ProductVariant productVariant, Int32 taxCategoryId, Customer customer) in C:\Users\mario\Documents\Visual Studio 2010\Projects\NopCommerce\Libraries\Nop.Services\Tax\TaxService.cs:237


--------------------------------------------------------------------------------------------

Here is the code:

----------------------CatalogController.cs -----------------------------------------------

        [ChildActionOnly]
        public ActionResult HomepageProducts()
        {
            var model = _productService.GetAllProductsDisplayedOnHomePage()
                .Select(x => PrepareProductOverviewModel(x))
                .ToList();

            return PartialView(model);
        }

--------------------------------------------------------------------------------------------

I don't know how to do a remote debug so I cannot trace it. But I cannot imagine that "var model" is null because nopCommerce created the remote database from the IIS server. And why does the stack trace show "C:\Users\mario\Documents\Visual Studio 2010\Projects", this only exist in the development desktop and not the IIS server?

Someone mentioned in another post that he fix the problem by copying the InstalledPlugins.txt file to the App_data Folder. I tried this, and also tried including it in the project App_data and still get the null reference exception.

Any help?

Thanks,
Mario
12 years ago
MarioRosario wrote:

...
Someone mentioned in another post that he fix the problem by copying the InstalledPlugins.txt file to the App_data Folder. I tried this, and also tried including it in the project App_data and still get the null reference exception.


Did you publish/copy the folder where you had already ran the app and created the database?  The presence of the Settings.txt file determines whether the install runs (so I was told).
In may case, I wanted to deploy the latest beta rev, and point to an existing db.  So that's why I copied both the Settings.txt and InstalledPlugins.txt from previously run/installed rev to new rev's folder
12 years ago
After I publish to my IIS Server, I don't see the Plugins, where do the plugins go? That could be the problem.
12 years ago
Ok, in my case, after publishing the nopCommerce site to my iis server, there are no Plugins. Manually copying all the Plugins to the server fixed the problem. I should file a bug for this.
12 years ago
https://www.nopcommerce.com/boards/t/10500/publishing-20.aspx
12 years ago
How are you publishing the site?
12 years ago
theonlylawislove wrote:
How are you publishing the site?


After compile then using VS2010 Menu - Build/Publish Selection, FTP mode.
12 years ago
Refer to a.m.'s link posted above. That is not the correct way to publish nopCommerce.

Run Deploy.bat and use the output of Deployable/ as your website.
12 years ago
theonlylawislove wrote:
Refer to a.m.'s link posted above. That is not the correct way to publish nopCommerce.

Run Deploy.bat and use the output of Deployable/ as your website.


I've finally got Prepare.bat to work, (by adding to build.bat: MSBuild.exe ...  /p:Configuration=Release /p:Platform="Any CPU")
but I still can't get Deploy.bat to work.  It complained about OutputPath not found.  So after some research I added this to the MSBuild  params too:  /p:OutputPath=bin\Release
I got further, but now it complains  "....  Could not find file 'obj\Any CPU\Release\Nop.Web.dll'   ..."

         C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplica
       tions\Microsoft.WebApplication.targets(132,5): error MSB3021: Unable to
       copy file "obj\Any CPU\Release\Nop.Web.dll" to "C:\Users\D\Document
       s\Visual Studio 2010\Projects\nopCommerce 2.00 BETA Revs\nopcommerce-992
       2d2494295\src\build\..\Deployable\nop_2.0\\bin\Nop.Web.dll". Could not f
       ind file 'obj\Any CPU\Release\Nop.Web.dll'. [C:\Users\D\Documents\V
       isual Studio 2010\Projects\nopCommerce 2.00 BETA Revs\nopcommerce-9922d2
       494295\src\Presentation\Nop.Web\Nop.Web.csproj]

(the output path looks funny too, with   build\..\  and   nop_2.0\\bin)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.