NetCore1.1 + initial Linux deployment experience, initial netcore1.1 experience
NetCore1.1 + initial Linux deployment experience
1. Prepare the environment
Centaos7 + Win10 Virtual Machine
Install VS2017 in Win10. Check. Net Core.
3. Centaos install netcore 1.1 see https://www.microsoft.com/net/core
sudo yum install libunwind libicucurl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?linkid=848821sudo mkdir -p /opt/dotnet && sudo tar zxf dotnet.tar.gz -C /opt/dotnetsudo ln -s /opt/dotnet/dotnet /usr/local/bin
dotnet new console -o hwappcd hwapp
Dotnet restore
The main purpose is to find the project files under the current directory, then use the NuGet library to restore the dependent libraries of the entire project, traverse each directory, generate a project file, and continue to restore the dependencies in the project file;
Dotnet run
If it is interactive, run directly; otherwise, compile and execute
2. Project Preparation
1. My project name is NetCore. Api
2. modify Release support;
. NET Core completely abandons project. json and completely changes back to. csproj
How to generate a cross-platform package after removing project. json from Asp. NetCore1.1
Open: NetCore. Api. csproj add release support RuntimeIdentifiers Configuration
<PropertyGroup> <RuntimeIdentifiers>win10-x64;centos.7-x64</RuntimeIdentifiers></PropertyGroup>
3. Open Program. cs to modify port support
public static void Main(string[] args) { var host = new WebHostBuilder() .UseKestrel() .UseUrls("http://*:8088") .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseStartup<Startup>() .UseApplicationInsights() .Build(); host.Run(); }
4. There is no problem in compiling and running. You can use WinSCP to upload data to the Centaos7 server.
3. Linux deployment
Go to the uploaded project directory
Dotnet restore command to restore Dependencies
Release the project file after restoration.
Dotnet publish
Copy the published file to the running folder.
Cp-rf/home/xupp/website/bin/Debug/netcoreapp1.1/publish // home/xupp/web. test/
Run the project
Nohup dotnet NetCore. Api. dll
For testing purposes only. In the official environment, you can use the Supervisor daemon [/code].
Test the Internet to check whether the service can be accessed. if the service is inaccessible, run dotnet NetCore. Api. dll first and check the firewall configuration.
Ngiux configuration (for Server Load balancer)
Ngiux Installation
Simple Ngiux Configuration
How to generate a cross-platform package after removing project. json from Asp. NetCore1.1
For more information about NetCore2.0 experience, see:
Http://www.cnblogs.com/linezero/p/nightlynetcore2.html
Http://www.php.cn/csharp-article-363405.html
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.