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)

相关文章

项目要求通过网站上传大文件,比如视频文件,通过摸索实现了文件分片来上传,然后后台进行合并。 使用了...
安装新版本的Nginx(vim /etc/yum.repos.d/nginx.repo) [nginx-stable] name=nginx stable repo baseu...
什么是 SignalR ASP.NET Core ASP.NET Core SignalR 是一种开放源代码库,可简化将实时 web 功...
在Windows下使用Docker,我们选择Docker Desktop这个软件,非常方便。 ## Docker Desktop介绍及安装 Do...
项目开始设计的是运行在windows下,所以一开始采用的是windows服务模式来获取多媒体文件信息,后来要求...
银河麒麟高级服务器操作系统V10是针对企业级关键业务,适应虚拟化、云计算、大数据、工业互联网时代对主...