Policy Injection With Unity & EntLib 5.0

Topics: Policy Injection Application Block, Security Application Block
Jul 19, 2010 at 2:54 PM


I'm working on a project that uses interception to provide authorization checks, (using the standard security blocks and ASP.NET membership authorization provider). Windows XP sp3, VS2008 SP1, .NET 3.5 SP1.

If I use the configuration settings provided by the legacy EntLib 4 configuration, and resolve my intercepted class using a 

method everything works fine and it creates a proxy wrapper class. So I tried to update this to use V5 Unity style configuration and policy injection with the intent of using interface interception, (because the documentation indicates that this performs significantly better). But at the point the code reads the     
<sectionExtension type="Microsoft.Practices.Unity.InterceptionExtension.Configuration.InterceptionConfigurationExtension, Microsoft.Practices.Unity.Interception.Configuration"/>

section of the configuration, it throws a System.IO.FileNotFound exception. I think it's a Dll issue so I've started to build the various sources, (CommonServiceLocator, Unity, EntLib50Src), to try to address the issue but I'm having problems preventing the final build of my own code from referencing signed versions of the Microsoft.Practices assemblies - even though I've reference all of my built assemblies directly.


Any ideas would be really helpful.



Jul 19, 2010 at 6:08 PM

Well, the obvious question is do you have the Microsoft.Practices.Unity.Interception.Configuration assembly in your bin directory when running?

If you do, have you run with fuslogvw turned on to see which file it actually can't find?

We do ship all the assemblies you need to get this to work, honest. :-) So you shouldn't need to go rebuilding entlib just to get this to work.

Jul 20, 2010 at 9:10 PM

Thanks. Going through the exercise of finding, recompiling from sources was a useful exercise to overcome the version-specific assembly loads.

It wasn't until I'd created a single solution with project references between the Enterprise Library and the Service Locator and Unity projects that I was able to execute my own code with a consistent set of assemblies

- if only to allow me to debug the configuration file load to find I'd got a typo in one of my type specifiers in the policy section.