EntLib Dev Guide RC - Code Samples

Topics: Enterprise Library Core, Security Application Block
Jun 16, 2011 at 4:16 PM

I'm trying to run the Security code sample from the "Entlib Dev Guide RC - Code samples" but after successfully compiling the solution, when the program runs and attempts to resolve some objects, errors start to occur.

The first line it tries to resolve is:

static ISecurityCacheProvider secCache

secCache = EnterpriseLibraryContainer.Current.GetInstance<ISecurityCacheProvider>("CacheProvider");

Which cause the following error:

Activation error occured while trying to get instance of type ISecurityCacheProvider, key "CacheProvider"

InnerException message is:

Resolution of the dependency failed, type = "Microsoft.Practices.EnterpriseLibrary.Security.ISecurityCacheProvider", name = "Security Cache".Exception occurred while: while resolving.Exception is: InvalidOperationException - The current type, Microsoft.Practices.EnterpriseLibrary.Security.ISecurityCacheProvider, is an interface and cannot be constructed. Are you missing a type mapping?-----------------------------------------------At the time of the exception, the container was:
  Resolving Microsoft.Practices.EnterpriseLibrary.Security.ISecurityCacheProvider,Security Cache

I haven't made any updates to the solution so is there any further configuration to be done before it can work out of the box?

 

Jun 17, 2011 at 4:36 AM

Hi,

I'm not even sure how did you managed to run the solution since there are some inconsistencies with the referenced assemblies (referenced EntLib assemblies are pointing to version 4.1). I tried to re-reference the assemblies to version 5 and all is working fine now. Also note that you need to create a new key on your Cryptography Settings for the application to work.

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jun 17, 2011 at 10:30 AM
AvanadeSupport wrote:

Hi,

I'm not even sure how did you managed to run the solution since there are some inconsistencies with the referenced assemblies (referenced EntLib assemblies are pointing to version 4.1). I tried to re-reference the assemblies to version 5 and all is working fine now. Also note that you need to create a new key on your Cryptography Settings for the application to work.

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

 

Thank you for your response.


Unfortunately all the assemblies being referenced are pointing correctly to version 5 e.g:

Name: Microsoft.Practices.EnterpriseLibrary.Security.Cache.CachingStore
Copy Local: True
Path: C:\Program Files\Microsoft Enterprise Library 5.0\Bin\Microsoft.Practices.EnterpriseLibrary.Security.Cache.CachingStore.dll
Version: 5.0.414.0
Is there any other setting that I need to check to get the solution to run properly?
Jun 17, 2011 at 10:58 AM

Since we can't reproduce it in our end, it would be nice if you can send us the repro project so we can look further to the issue. You can send it at entlib.support@avanade.com

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jun 17, 2011 at 2:34 PM

I already received the sample solution and its the same solution that I've tested and unfortunately it has the same problem. Have you checked the referenced dll's property and see if it is really version 5.0.0.0 and not 4.1.0.0? Also try to re-reference all the assemblies from C:\Program Files\Microsoft Enterprise Library 5.0\Bin, compile it and see if it works? I've already sent my working solution and see if it works for you too.

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com