why app_start start

2135 ワード


 
 
Add following code for your class:
[assembly: WebActivatorEx.PostApplicationStartMethod(typeof(WeChatSchools.App_Start.MyStartPoint), "Initialize")]

 
 
ex:
 
using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.Mvc;



[assembly: WebActivatorEx.PostApplicationStartMethod(typeof(WeChatSchools.App_Start.MyStartPoint), "Initialize")]



namespace WeChatSchools.App_Start

{

    public class MyStartPoint 

    {



        public static void Initialize()

        {

            Start();

        }





        public static void Start()

        {

            BLL.Helpers.EntityHelper.Log("start point");

        }



    }

}