views:

34

answers:

1

Part of a web application we have uses an in-house web control assembly. This assembly contains several web user controls where several of these are used by other web controls within the same assembly.

The assembly is built as a website with a web deployment project.

The main web application's pages are dynamically compiled through a service into a single assembly and placed into the appropriate bin folder. In our development server the old assemblies aren't always tidied up and removed, meaning the folder gets full of old assemblies.

When the page that uses the in-house web control assembly (mentioned above) runs, the asp.net instance throws an out of memory as it loads all the old assemblies in an attempt to determine which assembly houses the reference to the user control being used by the other user control inside the same assembly.

We've been using the following inside the top level user controls to register the other controls

<%@ Register Src="~/....ascx" TagPrefix="UC" TagName="...."  %>

Of course when the application runs this gives no information as to which assembly it can find it in.

Is there anyone that's come across this problem before? It's not really a problem as our live servers use a clean up tool to remove old assemblies, but there are still potential situations where we could get out of memory caused by this (for example the tool stops working!), so it would be nice to resolve this problem.

Thanks

Here is the stack trace

[OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.]
   System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
   System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +43
   System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +127
   System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +142
   System.Reflection.Assembly.Load(String assemblyString) +28
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46

[ConfigurationErrorsException: Exception of type 'System.OutOfMemoryException' was thrown.]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +613
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +203
   System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +105
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178
   System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath configPath, Boolean supportLocalization, String outputAssemblyName) +54
   System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories, Boolean isDirectoryAllowed) +8812786
   System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories) +128
   System.Web.Compilation.BuildManager.CompileCodeDirectories() +265
   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +320

[HttpException (0x80004005): Exception of type 'System.OutOfMemoryException' was thrown.]
   System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +58
   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +512
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +729

[HttpException (0x80004005): Exception of type 'System.OutOfMemoryException' was thrown.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8894095
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +85
   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +259
A: 

For those cases I do the registration of the controls in my web.config.

    <pages>
        <controls>
            <add tagPrefix="yourPrefix" namespace="Your.Lib.Controls" assembly="Your.Lib.Controls"/>
        </controls>
    </pages>
Yves M.
I've added this to the web.config without any success. I've tried with the tag prefix used in the aspx page, and the tag prefix used within the user controls.
Pete