.NET Core修改监听端口
把Program.cs加一行UseUrls代码如下:
using System.IO; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Builder; namespace HelloMvc { public class Program { public static void Main(string[] args) { var host = new WebHostBuilder() .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseDefaultHostingConfiguration(args) .UseIIS() .UseStartup<Startup>() .UseUrls("http://*:8888") .Build(); host.Run(); } } }
"唯有高屋建瓴,方可水到渠成"