Ejemplo n.º 1
0
        protected void Application_Start()
        {
            GlobalConfiguration.Configure(WebApiConfig.Register);

            //初始化log4net
            Log4Helper.LogConfig(Server.MapPath(@"~/Log4Net.config"));

            // 使api返回为json
            GlobalConfiguration.Configuration.Formatters.XmlFormatter.SupportedMediaTypes.Clear();

            //Autofac
            ApiAutofacRegisterConfig.BuildConfig();
        }
Ejemplo n.º 2
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);

            //隐藏mvc版本标头出现
            MvcHandler.DisableMvcResponseHeader = true;

            //初始化log4net
            Log4Helper.LogConfig(Server.MapPath(@"~/Log4Net.config"));

            //Autpfac IOC 控制反转
            AutofacRegisterConfig.BuildConfig();
        }