Last post Dec 14, 2007 10:42 AM by sjd0103
Nov 26, 2007 01:58 PM|misuk11|LINK
Im trying to implement caching using the enterprise library and am having a problem with this line
when the code tries to execute I get this error
Object reference not set to an instance of an object
I thought that the default cache manager should be returned ? In every example Ive seen for this, the first line of code is always included, yet I always get an error
Can anyone tell me what im doing wrong ?
Nov 27, 2007 06:07 AM|misuk11|LINK
has anyone actually managed to get this to work ?? Ive tried everything, followed many examples, they all create the CacheManager in the same way
CacheManager cacheManager = CacheFactory.GetCacheManager();
It never works for me, Ive used the enterprise configuration tool to modify my app.config file, included the correct assemblies, but I always get the Object reference error
Nov 27, 2007 10:29 AM|misuk11|LINK
ok, I guess no one can help me on this one, but here goes one last time.
Could the problem be related to the config files. My data access layer (which is where i put the class contining the caching code) has an app.config file. When I run my web app, using the config manager I read the connection string infornmation from the
web.config file NOT the app.config file./ So I assumed that any cache related settings should reside in the web.config file. Using the enterprise library configuration manager tool, I added the code necessary, these lines were added
even changing the new lines to match made no difference (why are they different anyway ?)
now when i run my app, at the point of connectiong to the database I get this error
An error occurred creating the configuration section handler for dataConfiguration: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Data The located assembly's manifest definition does not match the assembly
this is now going from bad to worse. All versions of 'Microsoft.Practices.EnterpriseLibrary.Data are the same 22.214.171.124
Am I on the right track for using caching in my app (ie plaing the code in the web.config file, not the app.config file) And why am I now getting this mismatch error. I hope someone can help, I spent over a day trying to
solve this problem, I thought it was meant to be straightforward ????
Dec 14, 2007 09:45 AM|sjd0103|LINK
Dec 14, 2007 10:26 AM|misuk11|LINK
I managed to resolve my problem eventually, see my post here
http://forums.asp.net/t/1182019.aspx it may help you. You need to have a section in the web.config inside the web app for caching to work
Dec 14, 2007 10:42 AM|sjd0103|LINK
Thanks misuk11...I have an AppDomain problem and need to go back to the drawing board.
I want my Class Library to be self contained and use caching (via Ent Lib), which seems to be impossible. The CacheFactory always reverts to the AppDomain of the referencing app...which makes sense, but then my .dll is no longer self contained </loop>.