I'm seeing an unusual parser/compilation issue with an ASP.NET 2.0 application I need help with. I've deployed a few commercial ASP.NET 2.0 apps already (including one really big one: ~1M visitors/day) but it's the first time I've seen this issue. From my Google searches it appears this question has been asked before only once --here on these forums-- but not answered. This bug is a showstopper for our current project; we can't deploy because of it.
Once the application gets into the error state, I see one of these two error messages for all pages. For simple .ASPX pages, the error is:
Unable to cast object of type 'System.Web.Compilation.BuildResultCompiledAssembly' to type 'System.Web.Util.ITypedWebObjectFactory'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Web.Compilation.BuildResultCompiledAssembly' to type 'System.Web.Util.ITypedWebObjectFactory'.
Stack Trace:
[InvalidCastException: Unable to cast object of type 'System.Web.Compilation.BuildResultCompiledAssembly' to type 'System.Web.Util.ITypedWebObjectFactory'.] System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +123 System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +54 System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +31 System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +40 System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +139 System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +120 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155 |
For pages with user controls, the issue manifests itself as a nonsense parser error:
Parser Error Message: The file 'src' is not a valid here because it doesn't expose a type.
Source Error:
Line 1: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Profile.aspx.cs" Inherits="RDWeb.Profile" %> Line 2: Line 3: <%@ Register src="Controls/PostList.ascx" TagName="PostList" TagPrefix="rd" %> Line 4: <%@ Register src="Controls/Expertise.ascx" TagName="Expertise" TagPrefix="rd" %> Line 5: <%@ Register src="Controls/Activities.ascx" TagName="Activities" TagPrefix="rd" %> |
Source File: /profile.aspx Line: 3
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
The only way I've found to "reset" the web site is to replace the DLL file in \bin. The usual means of app domain recycling (IISRESET, change web.config) do not clear this error. Unfortunately the "fix" doesn't last long... the site returns to this state quickly, usually within an hour.
Can anyone tell me what this issue is, and how to resolve it?
thanks!
Susan