启动一个ASP.NET MVC 4应用时,执行code [英] execute code when starting an ASP.NET MVC 4 Application
本文介绍了启动一个ASP.NET MVC 4应用时,执行code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的应用程序启动时,执行一些code我想
I want when my application starts, to execute some code
if (!WebMatrix.WebData.WebSecurity.Initialized){
WebMatrix.WebData.WebSecurity.InitializeDatabaseConnection("DefaultConnection", "UserProfile", "UserId", "UserName", autoCreateTables: true);
有是在项目文件夹App_start,但我没有发现我可以添加此code的任何文件。你知道,如果没有具有此目的的特定文件?
There is a folder App_start at the project, but I did not find any file that I can add this code. Do you know if there is a specific file that has this purpose?
非常感谢
推荐答案
这种启动code通常去在Application_Start()方法的Global.asax.cs文件
this kind of startup code typically goes in the Application_Start() method, Global.asax.cs file
这篇关于启动一个ASP.NET MVC 4应用时,执行code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文