asp.net – ActivationManager构建过程中的异常?

前端之家收集整理的这篇文章主要介绍了asp.net – ActivationManager构建过程中的异常?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在VS 2010中构建网站项目时,我收到以下异常:
The pre-application start initialization method Run on type WebActivator.ActivationManager  threw an exception with the following error message: Exception has been thrown by the target of an invocation..

我该怎么去调试?当我在VS.NET和命令行(例如,通过NAnt / MSBuild)中构建时,会发生这种情况。

解决方法

解决这个问题,您需要将-errorstack参数提供给aspnetcompiler。那么当它失败时,你不仅可以获得你现在看到的异常的堆栈跟踪,还可以获得它正在包装的InnerException。例如,当构建错误是由于未加载Cassette dll的问题引起的时,这里是输出
error ASPRUNTIME: The pre-application start initialization method Run on type We
bActivator.ActivationManager threw an exception with the following error message
: Exception has been thrown by the target of an invocation..

[TypeLoadException]: Could not load type 'Cassette.Configuration.ICassetteConfig
uration' from assembly 'Cassette,Version=0.8.1.0,Culture=neutral,PublicKeyTok
en=null'.
   at Cassette.Web.StartUp..cctor()

[TypeInitializationException]: The type initializer for 'Cassette.Web.StartUp' t
hrew an exception.
   at Cassette.Web.StartUp.PreApplicationStart()

[TargetInvocationException]: Exception has been thrown by the target of an invoc
ation.
   at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method,Ob
ject target,Object[] arguments,SignatureStruct& sig,MethodAttributes methodAt
tributes,RuntimeType typeOwner)
   at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method,Obj
ect target,Signature sig,MethodAttributes methodAttributes,RuntimeType typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj,BindingFlags invoke
Attr,Binder binder,Object[] parameters,CultureInfo culture,Boolean skipVisib
ilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj,CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj,Object[] parameters)
   at WebActivator.BaseActivationMethodAttribute.InvokeMethod()
   at WebActivator.ActivationManager.RunActivationMethods[T]()
   at WebActivator.ActivationManager.RunPreStartMethods()
   at WebActivator.ActivationManager.Run()

[InvalidOperationException]: The pre-application start initialization method Run
 on type WebActivator.ActivationManager threw an exception with the following er
ror message: Exception has been thrown by the target of an invocation..
   at System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`
1 methods)
   at System.Web.Compilation.BuildManager.CallPreStartInitMethods()
   at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appMan
ager,IApplicationHost appHost,IConfigMapPathFactory configMapPathFactory,Host
ingEnvironmentParameters hostingParameters,PolicyLevel policyLevel,Exception a
ppDomainCreationException)

[HttpException]: The pre-application start initialization method Run on type Web
Activator.ActivationManager threw an exception with the following error message:
 Exception has been thrown by the target of an invocation..
   at System.Web.Compilation.ClientBuildManager.EnsureHostCreated()
   at System.Web.Compilation.ClientBuildManager.PrecompileApplication(ClientBuil
dManagerCallback callback,Boolean forceCleanBuild)
   at System.Web.Compilation.Precompiler.Main(String[] args)

猜你在找的asp.Net相关文章