Previous articleUsing Nginx in CentOS 7 to reverse the project created in .Net Core is the default project created, now let's publish the project we developed to CentOs, whether to reverse or use Nginx
1. Create a .Net Core 2.0 Mvc project. When creating a new project, the Controllers, Models, and Views folders of MVC will not be created, so we need to create it ourselves
MVC will be added in the startup item Startup.cs, but no routes will be created, so we need to add routes to the configuration
2. Publish to CentOs
Here we need to manually edit the project file that needs to publish the project
Add <RuntimeIdentifiers> win10-64;centos.7-x64 </RuntimeIdentifiers> under the PropertyGroup node
Then use PowerShell to publish our release file
First enter the project folder and then use dotnet publish -c release -r centos.7-x64 to publish the centos 7 version of the release file
The published file will be published to bin by default. This publish is the published file, and the published file needs to be uploaded to CentOS through FTP.
3. We use the SecureFXPortable.exe tool to upload all our release files to the aspnetcoreapp folder created in the previous article using Nginx in CentOS 7 to reverse .Net Core
4. Execute the project we uploaded using the command in Linux, where WebInLinux is the project
If it is prompted here that port 5000 is occupied, just kill it and execute it again.