.Net Core 2.0 asp.net deployed to Alibaba Cloud Ubuntu 16.04.3 LTS

1. Create a .net core asp.net default project with VS2017

2. Publish Release to the folder. Note, add the following line to the csjproj file: <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>

3. Install .NET Core Runtime on Alibaba Cloud Ubuntu

See: https://www.microsoft.com/net/download/linux-package-manager/ubuntu16-04/runtime-2.0.6

4. Upload the published program to Ubantu with FTP, execute the following

From the command line, run dotnet <app_assembly>.dll.
In a browser, navigate to http://<serveraddress>:<port> to verify the app works on Linux.

5. It is found that http://<serveraddress>:<port> cannot open the webpage at all in the browser, so 

netstat -tnl to see if port 5000 is normal

It is found that port 5000 is only valid for local 127.0.0.1. Of course, our client cannot access it.

Modify the program Programe.cs file

public static IWebHost BuildWebHost(string[] args) =>
            WebHost.CreateDefaultBuilder(args)
            .UseUrls("http://*:5000")
                .UseStartup<Startup>()
                .Build();

ok, republish, and then perform step 4 above, you can open the URL page normally on the client side!

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325392322&siteId=291194637