Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 30, 2012 03:04 AM by ricka6
Mar 27, 2012 12:48 PM|LINK
I have an ASP.NET MVC 3 Application that supports external Extensions.
Controllers of the extensions are compiled in their own assembly. When the assembly is dropped in a sub folder
of the application before the main application runs, the controllers are loaded correctly.
However, if I go through the following sequence:
1. Install my MVC Application
2. Start it (access a page of the application)
3. Stop the application
4. Drop my extensions assembly in the apropriate sub folder
The extensions Controllers are not found.
I debugged this problem and found out that this behavior is because of the MVC-ControllerTypeCache.xml file stored in:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\<appName>\<sub1>\<sub2>\UserCache
by the System.Web.Mvc.ControllerTypeCache class in the EnsureInitialized method.
This file does not get deleted when the application restarts and therefore the loaded assemblies are not rescanned for new Controller types.
1. Is there a better way to support dynamic addition of extensions to an MVC application?
2. Can this be considered a bug?
3. Is there a utility / setting that will force the "Temporary ASP.NET Files\<appName>" folder to be cleared?
Retalix Architecture Team
Mar 27, 2012 12:53 PM|LINK
How are these assemblies being loaded? MVC replies upon code being in the ~/bin folder -- did you try deploying there?
Mar 27, 2012 01:46 PM|LINK
The assemblies are loaded during application start by recursing into the Extensions folder and loading each assembly that is found.
Even in the situation that Extension Controllers are not being found, their assemblies are loaded in the process.
The problem is in the initialization of the ControllerTypeCache, which does not iterate through the loaded assemblies in the case that
the MVC-ControllerTypeCache.xml file is found.
Mar 30, 2012 03:04 AM|LINK
MVC replies upon code being in the ~/bin folder -- did you try deploying there?
Exactly. Thanks Brock