标签:view trim eth ret static efault font using center
using Microsoft.AspNetCore.Hosting; namespace MyWeb { class Program { static void Main(string[] args) { var host = new WebHostBuilder() .UseKestrel() // 指定WebServer为Kestrel .UseStartup<Startup>() // 配置WebHost .Build(); host.Run(); // 启动WebHost } } }
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.Logging; using Microsoft.AspNetCore.Http; namespace MyWeb { class Startup { public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { app.Run(c => { return c.Response.WriteAsync("Hello dotnet core."); }); } } }
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.Logging; using Microsoft.AspNetCore.Http; namespace MyWeb { class Startup { public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { app.Run(c => { var req = c.Request.Path.ToString().TrimStart(‘/‘); var res = string.Empty; switch (req) { case "1": res = "one"; break; case "2": res = "two"; break; default: res = "none"; break; } var mtd = string.Empty; switch (c.Request.Method) { case "GET": mtd = "请求方式: get"; break; case "POST": mtd = "请求方式:post"; break; default: mtd = "请求方式:none"; break; } return c.Response.WriteAsync(res); }); } } }
我们并没有看到我们使用Nuget应用的两个包,这也说明.NetCore2.0做了运行时包仓优化。参考:02、NetCore2.0--引用系统和第三方包时的优化
03、手工创建Asp.Net Core 2.0 web应用程序(探索最小架构)
标签:view trim eth ret static efault font using center
原文地址:http://www.cnblogs.com/netcore2/p/7410853.html