Running nopCommerce locally without IIS

9 months ago
FYI, for those wanting to run Nop.Web.exe locally (without IIS)...

Typically after I've built a new plugin and debugged it in Visual Studio, I'll build it in Release mode and test it in a "no source" version on my local PC.  
- Copy the plugin folder
   from source folder - \Presentation\Nop.Web\Plugins\NewPlugin
   to no source folder - \Plugins

- If you want to test the plugin's "Install" ability, then you should Uninstall it first from running nopCommerce in Visual Studio.  Or, if you don't want to reinstall (and assuming that your pointing t the same DB), then you can just manually update the no source \App_Data\plugins.json JSON file to add/update the section for the new plugin.

To run your no source site, you can dbl-click the Nop.Web.exe file in the folder.  Or from a DOS command window in the site foler, type Nop.Web.exe.
However, the site will only show
  Now listening on: http://localhost:5000
Most browsers will require that the site be SSL.  If not, you will get an error message like:
The connection for this site is not secure
localhost sent an invalid response.
ERR_SSL_PROTOCOL_ERROR


This is what needs to be done to run your site locally with SSL:
1) Generate a self-signed certificate using dotnet dev-certs:
-  Bring up a DOS window
-  type command
  dotnet dev-certs https --trust

2) Export the certificate pfx file
- type command
  dotnet dev-certs https --export-path C:\Users\yourusername\.dotnet\https\localhost.pfx

3) Add this Kestrel section to the site's \App_Data\appsettings.json file

"Kestrel": {
  "Endpoints": {
    "Http": {
      "Url": "http://localhost:5000"
    },
    "Https": {
      "Url": "https://localhost:5001",
      "Certificate": {
       "Path": "C:\\Users\\yourusername\\.dotnet\\https\\localhost.pfx"
      }
    }
  }
}

(and include a trailing "," at the end of the section if it's not the last JSON section ;)

4) Run Nop.web.exe
Now you should see
      Now listening on: http://localhost:5000
      Now listening on: https://localhost:5001

5) In browser address bar, type
localhost:5001


Not that the "Store" table in the DB will still likely have a different port number, so in Admin Warnings, you will see  , e.g.,
   Specified store URL (https://localhost:44369/) doesn't match this store URL (http://localhost:5001/)
You can then adjust that in admin, or you could have set up the Kestrel section to use the same port that VS used if you don't plan to run them both at the same time.
9 months ago
When you share great things with public. It become more useful :)

Nice thoughts you shared here noptools. Thank you :)