如何调试System.Web.Compilation.BuildManager中的事件?在IIS/ASP.net生命周期的哪个阶段调用它?
问题是,我有一些使用PreApplicationStartMethodAttribute的代码,但似乎没有触发。因此,我试图找出最好的方式来附加调试器到它。
这里有一些关于更大问题的更多细节,为什么PreApplicationStartMethodAttribute()在2013年的SharePoint中不起作用?,但是我已经把它分解成一个小问题来尝试并取得一些进展。
到目前为止我只能识别出下面的呼叫堆栈..。
BuildManager.GetPreStartInitMethodsFromAssemblyCollection() BuildManager.CallPreStartInitMethods ->
发布于 2013-04-16 18:54:37
我正在处理一个类似的(或者可能是相同的问题),并且可以给出完整的堆栈跟踪。您可以自己生成它,只需创建一个简单的小MVC应用程序,并在使用PreApplicationStartMethodAttribute调用的方法中抛出一个异常。你会得到:
[ApplicationException: joe was here]
MvcApplication2.JoeStart.Start() in c:\Users\Joe\Documents\Visual Studio 2012\Projects\MvcApplication2\MvcApplication2\JoeStart.cs:18
[InvalidOperationException: The pre-application start initialization method Start on type MvcApplication2.JoeStart threw an exception with the following error message: joe was here.]
System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +550
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +132
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +90
System.Web.Compilation.BuildManager.ExecutePreAppStart() +135
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516
[HttpException (0x80004005): The pre-application start initialization method Start on type MvcApplication2.JoeStart threw an exception with the following error message: joe was here.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9873784
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254https://stackoverflow.com/questions/15872893
复制相似问题