How to publish nopCommerce 4 to the server?

1 year ago
amirkhanjz wrote:
.net core don't need a webserver BUT(BUT,BUT) we use IIS as a web proxy with lots of options.


Can you provide some explanation of this?  I'm not sure I understand how this works.  Can we host nopCommerce without IIS?  Is there any advantage to that on a Windows server?


Thanks!

Jeremy
1 year ago
amirkhanjz wrote:
hi,
you can publish your nop4 application to iis by following these steps:

1- use vs publish option for nop.web project,
2- create a app pool on iis which is pointed to not managed code,
3- set iis physical path to the root folder (where lots of dll files and also now.web.exe is exist),

there is no more steps for publishing nop4 (.net core) project , but remember to setup .netcore module for server before running your project.


These steps worked for me.  In case anyone out there needs the link, here is where to download the .Net Core stuff for IIS: https://www.microsoft.com/net/download/dotnet-core/2.0.
1 year ago
Did something change in 4.10? Everything is running great on my local system using SQL Server Express. I can login, I can register, I can administrate, made lots of changes in configuration settings, all good.

However, I published to a folder (using Release, Any CPU) to get ready to push it up to the web server, but there is no datasettings.json file in App_Data so I can change the database info to the one that I will be using on the web server.

Thanks,

Michael
1 year ago
Issue Resolved: It turns out that dataSettings.json file is not set to Publish, this is what I did to resolve my issue:

1. Right click dataSettings.json in your Visual Studio project and select properties.
2. Set "Copy to Output Directory" to "Copy Always".
3. I also set "Build Action" to "None", but not sure if this had anything to do with it.

After this, my dataSettings.json file is always included in Publish.

CAMSDev wrote:
Did something change in 4.10? Everything is running great on my local system using SQL Server Express. I can login, I can register, I can administrate, made lots of changes in configuration settings, all good.

However, I published to a folder (using Release, Any CPU) to get ready to push it up to the web server, but there is no datasettings.json file in App_Data so I can change the database info to the one that I will be using on the web server.

Thanks,

Michael
1 year ago
1- Make sure to install asp.net core on the webserver
2- Create a folder on your webserver for the nopCommerce Project
3- Setup an IIS website that points to that folder
4- Make sure the IIS app pool is set to "No managed code" and pipeline to integrated
5- On Visual Studio, publish Nop.web to the folder or using a different method, like MS Deploy
6- Copy two files from your source code to the folder on IIS.

\src\Presentation\Nop.Web\App_Data\dataSettings.json -> to same folder on IIS
\src\Presentation\Nop.Web\App_Data\installedPlugins.json _> to same folder on IIS


As a developer, you don't want to include those files to your project. The main reason is you may want to have a different connection string on IIS than the one you used in Visual Studio. If you include those files, when you publish the project, those files will get overwritten. This really important if your publishing to a stage or production site.
10 months ago
fwiw: I was having issues publishing from VS 2017 to local IIS. It would only open up the NOP Installation page - I discovered that the published version had an empty dataSettings.json file ( not the values that were in the VS solution).  I simply copied the correct values into this empty file and ... voila - the site finally opened.

dataSettings.json (in the published version is at the root under App_Data )
10 months ago
D:\Vandit\nopCommerce_4.10_Source_Fresh\Presentation\Nop.Web.Framework\WebStoreContext.cs:line 73
   at Nop.Services.Tasks.TaskThread..cctor() in D:\Vandit\nopCommerce_4.10_Source_Fresh\Libraries\Nop.Services\Tasks\TaskThread.cs:line 32

i got this error

what solution ?
6 months ago
I've merged various posts including this one to document how to publish NopCommerce 4.x custom source to server.

-----

Download the source code from GitHub on your local DEVELOPMENT computer which has Visual Studio
Open the solution and compile it
Some people deploy to production server using Visual Studio, I PUBLISH the source to a local folder and then copy the compiled source code to production
I guess the Visual Studio approach could be smarter, but you have to remember to configure it so you don't overwrite json files in the App_Data folder

------

HOW TO INSTALL NopCommerce 4.x on WINDOWS PRODUCTION SERVER

a) Install asp.net core software bundle on the webserver (NetCoreSoftwareBundle)
https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?tabs=aspnetcore2x&view=aspnetcore-2.2

b) Install Web Platform Installer (I didn't need it but put in on anyway)
https://www.microsoft.com/web/downloads/platform.aspx

c) Configure IIS and folders
https://www.nop-templates.com/how-to-install-nopcommerce

-> In IIS Manager, open the server's node and select "Add Website"
SiteName: www_yoursite_com (the site domain CNAME record needs to point to your production server IP address)
www.yoursite.com
Edit application pool and set .NET CLR version = "No Managed Code"

-> Set permissions on these folders:
App_Data
Plugins
Logs
wwwroot\bundles
wwwroot\db_backups
wwwroot\files\exportimport
wwwroot\images

enabling Write/Read for these users:
Authenticated Users
iis apppool\DefaultAppPool (probably not necessary but did it anyway)
iis apppool\www_yoursite_com
iis_iusrs

-> Choose a UserAccount
IIS Manager, Application Pools, www_yoursite_com
Advanced settings
Identity setting, custom account, set to: Administrator

d) Open a browser, type in the web site address and proceed with the installation
as shown in point 7
https://www.nop-templates.com/how-to-install-nopcommerce
1 month ago
I follow all solutions in this but my problem not solved .
after I published my nopcommerce 4.2 solution via VS and upload it to Host ,
I got this error :

An error occurred while starting the application.
.NET Core 4.6.28207.03 X64 v4.0.0.0    |   Microsoft.AspNetCore.Hosting version 2.2.0-rtm-35687    |    Microsoft Windows 10.0.14393    |   Need help?

in the logs folder , I have this error log :

Application startup exception: System.IO.FileNotFoundException: Could not load file or assembly 'ClearPluginAssemblies, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
File name: 'ClearPluginAssemblies, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, IntPtr ptrLoadContextBinder)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, IntPtr ptrLoadContextBinder)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at System.AppDomain.Load(AssemblyName assemblyRef)
   at Nop.Core.Infrastructure.AppDomainTypeFinder.LoadMatchingAssemblies(String directoryPath) in C:\Users\User\Documents\My Web Sites\nopCommerce_4.20\src\Libraries\Nop.Core\Infrastructure\AppDomainTypeFinder.cs:line 114
   at Nop.Core.Infrastructure.WebAppTypeFinder.GetAssemblies() in C:\Users\User\Documents\My Web Sites\nopCommerce_4.20\src\Libraries\Nop.Core\Infrastructure\WebAppTypeFinder.cs:line 59
   at Nop.Core.Infrastructure.NopEngine.ConfigureServices(IServiceCollection services, IConfiguration configuration, NopConfig nopConfig) in C:\Users\User\Documents\My Web Sites\nopCommerce_4.20\src\Libraries\Nop.Core\Infrastructure\NopEngine.cs:line 159
   at Nop.Web.Framework.Infrastructure.Extensions.ServiceCollectionExtensions.ConfigureApplicationServices(IServiceCollection services, IConfiguration configuration, IHostingEnvironment hostingEnvironment) in C:\Users\User\Documents\My Web Sites\nopCommerce_4.20\src\Presentation\Nop.Web.Framework\Infrastructure\Extensions\ServiceCollectionExtensions.cs:line 83
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.Initialize()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()


crit: Microsoft.AspNetCore.Hosting.Internal.WebHost[6]
      Application startup exception
System.IO.FileNotFoundException: Could not load file or assembly 'ClearPluginAssemblies, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
File name: 'ClearPluginAssemblies, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, IntPtr ptrLoadContextBinder)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, IntPtr ptrLoadContextBinder)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at System.AppDomain.Load(AssemblyName assemblyRef)
   at Nop.Core.Infrastructure.AppDomainTypeFinder.LoadMatchingAssemblies(String directoryPath) in C:\Users\User\Documents\My Web Sites\nopCommerce_4.20\src\Libraries\Nop.Core\Infrastructure\AppDomainTypeFinder.cs:line 114
   at Nop.Core.Infrastructure.WebAppTypeFinder.GetAssemblies() in C:\Users\User\Documents\My Web Sites\nopCommerce_4.20\src\Libraries\Nop.Core\Infrastructure\WebAppTypeFinder.cs:line 59
   at Nop.Core.Infrastructure.NopEngine.ConfigureServices(IServiceCollection services, IConfiguration configuration, NopConfig nopConfig) in C:\Users\User\Documents\My Web Sites\nopCommerce_4.20\src\Libraries\Nop.Core\Infrastructure\NopEngine.cs:line 159
   at Nop.Web.Framework.Infrastructure.Extensions.ServiceCollectionExtensions.ConfigureApplicationServices(IServiceCollection services, IConfiguration configuration, IHostingEnvironment hostingEnvironment) in C:\Users\User\Documents\My Web Sites\nopCommerce_4.20\src\Presentation\Nop.Web.Framework\Infrastructure\Extensions\ServiceCollectionExtensions.cs:line 83
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.Initialize()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()



the file 'ClearPluginAssemblies.dll' is there