Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 30, 2012 03:04 AM by ricka6
0 Points
3 Posts
Mar 27, 2012 12:48 PM|LINK
Hi,
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?
Thanks,
---
Adar Wesley
Retalix Architecture Team
All-Star
27534 Points
4907 Posts
MVP
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.
15070 Points
2272 Posts
Microsoft
Moderator
Mar 30, 2012 03:04 AM|LINK
BrockAllen MVC replies upon code being in the ~/bin folder -- did you try deploying there?
Exactly. Thanks Brock
AdarWesley
0 Points
3 Posts
ASP.NET MVC Application with Extensions - Extensions not found if installed after application run...
Mar 27, 2012 12:48 PM|LINK
Hi,
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?
Thanks,
---
Adar Wesley
Retalix Architecture Team
BrockAllen
All-Star
27534 Points
4907 Posts
MVP
Re: ASP.NET MVC Application with Extensions - Extensions not found if installed after application...
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?
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
AdarWesley
0 Points
3 Posts
Re: ASP.NET MVC Application with Extensions - Extensions not found if installed after application...
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.
---
Adar Wesley
ricka6
All-Star
15070 Points
2272 Posts
Microsoft
Moderator
Re: ASP.NET MVC Application with Extensions - Extensions not found if installed after application...
Mar 30, 2012 03:04 AM|LINK
Exactly. Thanks Brock