把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();
}
}
}