“已部署站点上的“无法加载类型”,是指旧页面/类

问题描述 投票:0回答:3

[当我在VS调试器中运行代码并将其设置为捕获时引发CLR异常时,我得到大量的HttpException,它们表示“无法加载类型”,它们引用已从应用程序中删除的页面/类。它不会对页面造成任何问题(.NET知道以某种方式忽略此异常),但这确实很烦人。

堆栈跟踪:

System.Web.dll!System.Web.UI.TemplateParser.GetType(string typeName, bool ignoreCase, bool throwOnError) + 0x1b0 bytes  
System.Web.dll!System.Web.UI.TemplateParser.ProcessInheritsAttribute(string baseTypeName, string codeFileBaseTypeName, string src, System.Reflection.Assembly assembly) + 0x62 bytes    
System.Web.dll!System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(System.Collections.IDictionary parseData) + 0x118 bytes  
System.Web.dll!System.Web.UI.PageParser.PostProcessMainDirectiveAttributes(System.Collections.IDictionary parseData) + 0x6b bytes   
System.Web.dll!System.Web.UI.TemplateParser.ProcessMainDirective(System.Collections.IDictionary mainDirective) + 0x18b bytes    
System.Web.dll!System.Web.UI.TemplateControlParser.ProcessMainDirective(System.Collections.IDictionary mainDirective) + 0x90 bytes  
System.Web.dll!System.Web.UI.PageParser.ProcessMainDirective(System.Collections.IDictionary mainDirective) + 0x11 bytes 
System.Web.dll!System.Web.UI.TemplateParser.ProcessDirective(string directiveName, System.Collections.IDictionary directive) + 0x13f bytes  
System.Web.dll!System.Web.UI.BaseTemplateParser.ProcessDirective(string directiveName, System.Collections.IDictionary directive) + 0x1ea bytes  
System.Web.dll!System.Web.UI.TemplateControlParser.ProcessDirective(string directiveName, System.Collections.IDictionary directive) + 0x44 bytes    
System.Web.dll!System.Web.UI.PageParser.ProcessDirective(string directiveName, System.Collections.IDictionary directive) + 0x45 bytes   
System.Web.dll!System.Web.UI.TemplateParser.ParseStringInternal(string text, System.Text.Encoding fileEncoding) + 0x378 bytes   
System.Web.dll!System.Web.UI.TemplateParser.ParseString(string text, System.Web.VirtualPath virtualPath, System.Text.Encoding fileEncoding) + 0x6f bytes    
System.Web.dll!System.Web.UI.TemplateParser.ParseFile(string physicalPath, System.Web.VirtualPath virtualPath) + 0x115 bytes    
System.Web.dll!System.Web.UI.TemplateParser.ParseInternal() + 0x57 bytes    
System.Web.dll!System.Web.UI.TemplateParser.Parse() + 0x64 bytes    
System.Web.dll!System.Web.Compilation.BaseTemplateBuildProvider.CodeCompilerType.get() + 0x6f bytes 
System.Web.dll!System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(System.Web.Compilation.BuildProvider buildProvider) + 0x42 bytes   
System.Web.dll!System.Web.Compilation.WebDirectoryBatchCompiler.CompileNonDependentBuildProviders(System.Collections.ICollection buildProviders) + 0xca bytes   
System.Web.dll!System.Web.Compilation.WebDirectoryBatchCompiler.Process() + 0x5d bytes  
System.Web.dll!System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(System.Web.Hosting.VirtualDirectory vdir, bool ignoreErrors) + 0x48 bytes   
System.Web.dll!System.Web.Compilation.BuildManager.BatchCompileWebDirectory(System.Web.Hosting.VirtualDirectory vdir, System.Web.VirtualPath virtualDir, bool ignoreErrors) + 0xbc bytes    
System.Web.dll!System.Web.Compilation.BuildManager.CompileWebFile(System.Web.VirtualPath virtualPath) + 0x5d bytes  
System.Web.dll!System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(System.Web.VirtualPath virtualPath, bool noBuild, bool allowCrossApp, bool allowBuildInPrecompile, bool throwIfNotFound, bool ensureIsUpToDate) + 0x141 bytes    
System.Web.dll!System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(System.Web.HttpContext context, System.Web.VirtualPath virtualPath, bool noBuild, bool allowCrossApp, bool allowBuildInPrecompile, bool throwIfNotFound, bool ensureIsUpToDate) + 0x70 bytes 
System.Web.dll!System.Web.Compilation.BuildManager.GetVPathBuildResult(System.Web.HttpContext context, System.Web.VirtualPath virtualPath, bool noBuild, bool allowCrossApp, bool allowBuildInPrecompile, bool ensureIsUpToDate) + 0x5b bytes   
System.Web.dll!System.Web.UI.BaseTemplateParser.GetReferencedType(System.Web.VirtualPath virtualPath, bool allowNoCompile) + 0x51 bytes 
System.Web.dll!System.Web.UI.PageParser.ProcessMainDirectiveAttribute(string deviceName, string name, string value, System.Collections.IDictionary parseData) + 0x67e bytes 
System.Web.dll!System.Web.UI.TemplateParser.ProcessMainDirective(System.Collections.IDictionary mainDirective) + 0xf9 bytes 
System.Web.dll!System.Web.UI.TemplateControlParser.ProcessMainDirective(System.Collections.IDictionary mainDirective) + 0x90 bytes  
System.Web.dll!System.Web.UI.PageParser.ProcessMainDirective(System.Collections.IDictionary mainDirective) + 0x11 bytes 
System.Web.dll!System.Web.UI.TemplateParser.ProcessDirective(string directiveName, System.Collections.IDictionary directive) + 0x13f bytes  
System.Web.dll!System.Web.UI.BaseTemplateParser.ProcessDirective(string directiveName, System.Collections.IDictionary directive) + 0x1ea bytes  
System.Web.dll!System.Web.UI.TemplateControlParser.ProcessDirective(string directiveName, System.Collections.IDictionary directive) + 0x44 bytes    
System.Web.dll!System.Web.UI.PageParser.ProcessDirective(string directiveName, System.Collections.IDictionary directive) + 0x45 bytes   
System.Web.dll!System.Web.UI.TemplateParser.ParseStringInternal(string text, System.Text.Encoding fileEncoding) + 0x378 bytes   
System.Web.dll!System.Web.UI.TemplateParser.ParseString(string text, System.Web.VirtualPath virtualPath, System.Text.Encoding fileEncoding) + 0x6f bytes    
System.Web.dll!System.Web.UI.TemplateParser.ParseFile(string physicalPath, System.Web.VirtualPath virtualPath) + 0x115 bytes    
System.Web.dll!System.Web.UI.TemplateParser.ParseInternal() + 0x57 bytes    
System.Web.dll!System.Web.UI.TemplateParser.Parse() + 0x64 bytes    
System.Web.dll!System.Web.Compilation.BaseTemplateBuildProvider.CodeCompilerType.get() + 0x6f bytes 
System.Web.dll!System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(System.Web.Compilation.BuildProvider buildProvider) + 0x42 bytes   
System.Web.dll!System.Web.Compilation.WebDirectoryBatchCompiler.CompileNonDependentBuildProviders(System.Collections.ICollection buildProviders) + 0xca bytes   
System.Web.dll!System.Web.Compilation.WebDirectoryBatchCompiler.Process() + 0x5d bytes  
System.Web.dll!System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(System.Web.Hosting.VirtualDirectory vdir, bool ignoreErrors) + 0x48 bytes   
System.Web.dll!System.Web.Compilation.BuildManager.BatchCompileWebDirectory(System.Web.Hosting.VirtualDirectory vdir, System.Web.VirtualPath virtualDir, bool ignoreErrors) + 0xbc bytes    
System.Web.dll!System.Web.Compilation.BuildManager.CompileWebFile(System.Web.VirtualPath virtualPath) + 0x5d bytes  
System.Web.dll!System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(System.Web.VirtualPath virtualPath, bool noBuild, bool allowCrossApp, bool allowBuildInPrecompile, bool throwIfNotFound, bool ensureIsUpToDate) + 0x141 bytes    
System.Web.dll!System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(System.Web.HttpContext context, System.Web.VirtualPath virtualPath, bool noBuild, bool allowCrossApp, bool allowBuildInPrecompile, bool throwIfNotFound, bool ensureIsUpToDate) + 0x70 bytes 
System.Web.dll!System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(System.Web.VirtualPath virtualPath, System.Web.HttpContext context, bool allowCrossApp, bool throwIfNotFound) + 0x7e bytes   
System.Web.dll!System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(System.Web.VirtualPath virtualPath, System.Type requiredBaseType, System.Web.HttpContext context, bool allowCrossApp) + 0x35 bytes 
System.Web.dll!System.Web.UI.PageHandlerFactory.GetHandlerHelper(System.Web.HttpContext context, string requestType, System.Web.VirtualPath virtualPath, string physicalPath) + 0x20 bytes  
System.Web.dll!System.Web.UI.PageHandlerFactory.GetHandler(System.Web.HttpContext context, string requestType, string virtualPath, string path) + 0x26 bytes    
System.Web.dll!System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() + 0x14f bytes 
System.Web.dll!System.Web.HttpApplication.ExecuteStep(System.Web.HttpApplication.IExecutionStep step, ref bool completedSynchronously) + 0xb9 bytes 
System.Web.dll!System.Web.HttpApplication.PipelineStepManager.ResumeSteps(System.Exception error) + 0x39f bytes 
System.Web.dll!System.Web.HttpApplication.BeginProcessRequestNotification(System.Web.HttpContext context, System.AsyncCallback cb) + 0x5a bytes 
System.Web.dll!System.Web.HttpRuntime.ProcessRequestNotificationPrivate(System.Web.Hosting.IIS7WorkerRequest wr, System.Web.HttpContext context) + 0xbe bytes   
System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(System.IntPtr managedHttpContext, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags) + 0x247 bytes 
System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(System.IntPtr managedHttpContext, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags) + 0x29 bytes    
[Native to Managed Transition]  
[Managed to Native Transition]  
System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(System.IntPtr managedHttpContext, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags) + 0x2cc bytes 
System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(System.IntPtr managedHttpContext, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags) + 0x29 bytes    
[Appdomain Transition]  
asp.net debugging visual-studio-debugging httpexception
3个回答
2
投票

我用aspnet_compiler在debugging an error时解决了这个问题。原来,我的项目在整个站点的内容目录中都有物理的.aspx文件,这些文件已从我的项目中“排除”。因为它们被排除在外,所以它们不会引发任何编译时错误。

但是出于某种原因,网页(aspx)编译生成管理器会找到它们并尝试对其进行构建!我认为这与dll和aspx文件之间的编译分离有关。 aspnet_compiler不会在ProjectName.vbproj(或.csproj)中检查要编译的页面,它会编译所有页面。 (如果有人可以记录下来,那就太好了!)>


1
投票

我遇到了同样的问题。它带有一个ascx文件。但是,其背后的代码在dll中。它在一台服务器上工作,但不在另一台服务器上。 DLL之间的比较显示不一致。我们将DLL从工作版本复制到非工作版本,问题已解决。


0
投票

我最近在Web应用程序中遇到了这种情况。问题是nuget程序包引入了依赖项Microsoft.Net.Compiler和Microsoft.Code.Dom

© www.soinside.com 2019 - 2024. All rights reserved.