How to publish an ASP.NET Core with React.js project to your hosting account

Programming, error messages and sample code > ASP.NET

1. create an ASP.NET Core with React.js project in Visual Studio

  1. open Visual Studio
  2. File > New > Project
  3. search for ASP.NET Core with React.js, select, Next
  4. change Project name, choose Location, Next
  5. select Target Framework, Create

2. after the project created, start the project with/without debugging in Visual Studio

3. navigate to the Output window in Visual Studio, keep an eye on the "build" log

If you do not see the Output window, you will want to open it from Menu bar > View > Output (default shortcut keys: Ctrl+Alt+O)
Make sure the build progress goes through successfully
1>------ Build started: Project: project_name, Configuration: Debug Any CPU ------

1>Restoring dependencies using 'npm'. This may take several minutes...
#especially this area, if you see any errors, please fix them first

========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

4. design your application, test it in the development environment, prepare to deploy the application

5. follow the deployment instruction to publish an ASP.NET Core project in Visual Studio, you don't have to do any other configurations

6. access your site URL to check the application

If you get an error, please have a look at the followings, find the corresponding solution to troubleshoot
a) An error occurred while starting the application
solution: enable logging system for your application, check the real exception message, see details
b) One or more errors occurred. (One or more errors occurred. (Failed to start 'npm'. To resolve this...))
cause: the React.js ClientApp is not built with all necessary project files and related modules to the production directory while deploying
#1 open the command window in either your computer CMD or Visual Studio>Package Manager Console (default shortcut keys: Ctril+Q) or Command Window (default shortcut keys: Ctrl+Alt+A)
cd ClientApp
npm install
be sure the progress complete successfully. Then republish the application from Visual Studio via Web Deploy.
#2 publish the project to a local folder in Visual Studio (in the Publish settings, choose Target>Folder)
run your application on local IIS, or start it in localhost, make sure everything works. Then archive all folders&files in the publish folder to .zip file, upload the .zip file to your account, and complete the site setup.

c) HTTP Error 500.34 - ANCM Mixed Hosting Models Not Supported or 500.35 ANCM Multiple In-Process Applications in same Process

solution: please refer to this knowledge base