2016-10-20更新
今天的这篇文章还是一篇“Hello World”,只不过开发环境有所改变——Visual Studio Code+Angular2+Webapck,也算是正式的开篇了。
一、新建一个文件夹作为此次Demo的根目录,这里为:“F:\Visual Studio Code\app1”,并在“命令提示符中打开”,键入:dotnet new -t web 如下图:
说明:这不是一个空项目,作为一个demo,太罗嗦了!但是还不清楚如何如何创建空项目,如果有知道的,请不吝赐教!,这里对“Startup.cs”中的带代码做如下调整:
1 // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 2 public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) 3 { 4 loggerFactory.AddConsole(Configuration.GetSection("Logging")); 5 loggerFactory.AddDebug(); 6 7 if (env.IsDevelopment()) 8 { 9 app.UseDeveloperExceptionPage(); 10 app.UseDatabaseErrorPage(); 11 app.UseBrowserLink(); 12 } 13 else 14 { 15 app.UseExceptionHandler("/Home/Error"); 16 } 17 18 app.Use(async (context, next) => 19 { 20 await next(); 21 22 if (context.Response.StatusCode == 404 23 && !System.IO.Path.HasExtension(context.Request.Path.Value)) 24 { 25 context.Request.Path = "/index.html"; 26 await next(); 27 } 28 }); 29 30 app.UseStaticFiles(); 31 32 app.UseIdentity(); 33 34 // Add external authentication middleware below. To configure them please see https://go.microsoft.com/fwlink/?LinkID=532715 35 36 app.UseMvc(); 37 }