加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

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

发布时间:2020-12-16 00:45:47 所属栏目:asp.Net 来源:网络整理
导读:在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 invoc
在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)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读