不是的Application_Start射击? [英] Application_Start not firing?
问题描述
我有我工作的一个ASP.NET MVC(测试版)的应用程序,时遇到了问题搞清楚,如果我做错了什么,或者如果我的的Application_Start
在Global.asax.cs中的方法是,当我尝试调试应用程序其实不是射击。
I have an ASP.NET MVC (beta) application that I'm working on, and am having trouble figuring out if I'm doing something wrong, or if my Application_Start
method in Global.asax.cs is in fact not firing when I try to debug the application.
我把一个断点在我的的Application_Start
方法的路线,我希望,当我试图调试断点应该得到击中应用程序...但它从来不会。没有经过我重置IIS,我没有重新启动后,不是永远。我缺少的东西吗?为什么这个方法从不获取调用?
I put a breakpoint on a line in my Application_Start
method, and am expecting that when I attempt to debug the application that the breakpoint should get hit... but it never does. Not after I reset IIS, not after I reboot, not ever. Am I missing something? Why is this method never getting called?
推荐答案
如果这是在IIS中,应用程序可以让调试器附着之前启动。如果是这样,我不知道,如果你可以跟帖的睡眠足够长的时间得到重视。
If this is in IIS, the app can get started before the debugger has attached. If so, I am not sure if you can thread sleep long enough to get attached.
在Visual Studio中,您可以将调试器附加到进程。您可以通过点击调试为此>>附加到进程。连接到浏览器,然后打你的应用程序。为了安全起见,然后重新启动IIS和命中的站点。我并不是100%相信这将解决这个问题,但它会比在App_Start发射了一个线程睡眠好多了。
In Visual Studio, you can attach the debugger to a process. You do this by clicking Debug >> Attach to process. Attach to the browser and then hit your application. To be safe, then restart IIS and hit the site. I am not 100% convinced this will solve the problem, but it will do much better than firing off a thread sleep in App_Start.
另一种选择是暂时托管在内置的Web服务器,直到你完成调试应用程序启动。
Another option is temporarily host in the built in web server until you finish debugging application start.
这篇关于不是的Application_Start射击?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!