標籤:
2016年,.net 會有很多大更新 ASP.NET 5
在此之前我都是用著古老的.net做開發的 (WebForm + IIS)
為了接下來應對 .net 的新功能,我特地去學習了一下基本的 MVC Owin 等等.
接下來我會針對主題寫一些學習筆記.
MVC & Owin setup step
1.New empty project and add folders and code references for "MVC".
2.Install "Microsoft.Owin.Host.SystemWeb" (This is for host in IIS)
3.Remove Global.asax and App_Start
4.Add a Startup.cs file with below code
using System.Web.Mvc;using System.Web.Routing;using Microsoft.Owin;using Owin;[assembly: OwinStartupAttribute(typeof(test.Startup))]namespace test{ public class MVCRouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapMvcAttributeRoutes(); } } public partial class Startup { public void Configuration(IAppBuilder app) { AreaRegistration.RegisterAllAreas(); MVCRouteConfig.RegisterRoutes(RouteTable.Routes); } }}
View Code
Visual Studio 2015 Owin+MVC+WebAPI+ODataV4+Identity+Oauth2.0+AngularJS 1.x 學習筆記