Strange exception "Cannot set the ConfigurationCache property after calling Init"

Skip to first unread message

Kenny Evitt

Sep 19, 2013, 1:07:53 PM9/19/13
The exception is being generated by the code on line 59 of the S#arp Architecture file d:\Builds\SharpArch2\Solutions\SharpArch.NHibernate\NHibernateSession.cs. Here's the source for that file in GitHub.

The app code that's apparently indirectly generating the exception is the following (in my app's Global.asax.cs file):

            NHibernateSession.ConfigurationCache = new NHibernateConfigurationFileCache();

There's a Stack Overflow question for the same apparent issue, and the person that asked that question also posted a topic in this group (almost two years ago), but the only resolution offered was to comment out the above line.

My app is using multiple databases and it's using a custom session storage class, but what's particularly 'strange' is that neither of those are new. The app is running fine on my local dev computer and in IIS on a dev server. The exception first occurred (immediately?) after deploying to the production server earlier today.

Does anyone have any ideas about how this can be resolved?

I just re-deployed the latest build to the production server and now I'm getting a different error:

"Could not find a getter for property 'BlahBlahBlahId' in class 'Apps.Domain.Something'"

Is there something that needs to be done to 'invalidate' any existing cached configurations when a new version of the app is deployed (if there are changes to the domain entity classes)?

Kenny Evitt

Sep 19, 2013, 1:12:26 PM9/19/13
I found the S#arp Architecture wiki page about the configuration cache and I think I know what the problem is – the cache is being created without any assembly dependencies, hence it isn't being invalidated as it should.

Kenny Evitt

Sep 19, 2013, 1:27:32 PM9/19/13
[The "Could not find a getter for properpty ..." exception was promptly followed by the original exception.]

Based on the few examples of using the configuration cache, I couldn't figure out exactly how it needs to be constructed with the appropriate dependencies.

I was, however, able to resolve the error, by removing the serialized configuration cache files (from C:\Windows\Temp) and then restarting the site and recycling the app pool in IIS.

Seif Attar

Sep 19, 2013, 3:41:44 PM9/19/13
Glad you got it sorted.

You received this message because you are subscribed to the Google Groups "S#arp Architecture" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

Reply all
Reply to author
0 new messages