// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); services.Configure <MyOption>(Configuration); DataAccessCenter.Initilalize(new AnswerDbContext()); }
protected override void ApplicationStartup(ILifetimeScope container, IPipelines pipelines) { base.ApplicationStartup(container, pipelines); //数据库 // MYSQLHelper.ConnectionString = ConfigurationManager.ConnectionStrings["conn"].ToString(); DataAccessCenter.Load(); //请求跟踪 //StaticConfiguration.EnableRequestTracing = true;暂时不打开,性能消耗很大 //显示详细错误信息 StaticConfiguration.DisableErrorTraces = false; //启用AntiToken Csrf.Enable(pipelines); }