Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6580397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:01:28+00:00 2026-05-25T16:01:28+00:00

In my S#arp Arch 2.0 project, I’m communicating with 2 databases. This runs fine

  • 0

In my S#arp Arch 2.0 project, I’m communicating with 2 databases. This runs fine locally with the ASP.Net Development Server (VS 2010) and passes unit tests requiring talking to either database.

Next step was to Publish the project (using VS’ built-in “Publish” menu option) to the in-house development server (Windows Server 2008 R2) and fire this thing up on a real server where people could actually see it.

Now I get the exception shown in the title when I try to run the application. The exception is thrown at the = new NHibernateConfigurationFileCache() line below:

private void InitialiseNHibernateSessions()
    {
        NHibernateSession.ConfigurationCache = new NHibernateConfigurationFileCache();

        NHibernateSession.InitStorage(this.webSessionStorage);

        NHibernateSession.AddConfiguration(NHibernateSession.DefaultFactoryKey,
            new[] { Server.MapPath("~/bin/SRN2.Infrastructure.dll") },
            new AutoPersistenceModelGenerator().Generate(),
            Server.MapPath("~/NHibernate.config"),
            null, null, null);


        NHibernateSession.AddConfiguration(SRN2.Infrastructure.DataGlobals.OTHER_DB_FACTORY_KEY,
            new string[] { Server.MapPath("~/bin/SRN2.Infrastructure.dll") },
            new AutoPersistenceModelGenerator().Generate(),
            Server.MapPath("~/NHibernate-OTHER.config"),
            null, null, null);

    }

Stack trace:

[InvalidOperationException: Cannot set the ConfigurationCache property after calling Init]
   SharpArch.NHibernate.NHibernateSession.set_ConfigurationCache(INHibernateConfigurationCache value) +105
   SRN2.Web.Mvc.MvcApplication.InitialiseNHibernateSessions() in C:\code\SRN2-Sharp2\trunk\Solutions\SRN2.Web.Mvc\Global.asax.cs:122
   SharpArch.NHibernate.NHibernateInitializer.InitializeNHibernateOnce(Action initMethod) +116
   SRN2.Web.Mvc.MvcApplication.Application_BeginRequest(Object sender, EventArgs e) in     C:\code\SRN2-Sharp2\trunk\Solutions\SRN2.Web.Mvc\Global.asax.cs:71
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T16:01:28+00:00Added an answer on May 25, 2026 at 4:01 pm

    Jon is right, it does sound like your InitialiseNHibernateSessions method is being called multiple times. You don’t have to use the config cache, have you tried disabling it?

    The NHibernate configuration is cached to file in order to improve start up time. If the configuration has not changed it is loaded from the cache file. The default location of the cache file is the system temporary file folder (e.g. Path.GetTempPath()).

    If you don’t have file permissions, or don’t need config caching, just remove or comment out the line that initialises the configuration cache, i.e. this line:

    NHibernateSession.ConfigurationCache = new NHibernateConfigurationFileCache();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know S#arp architecture is built for ASP.NET MVC. But I'm wondering if it
I have an older asp.net mvc solution (s#arp framework) whith two projects one for
I decided to use ASP.NET MVC, S#arp Architectur and the Spark View Engine for
I am using s#arp architecture 2.0 with asp.net mvc 3.0. The razor code in
I am trying to get a simple prototype using ASP.NET S#arp-architecture (Sharp architecture) to
Anybody aware of a best practices or example project out there that uses ASP.NET
What’s the equivalent of S#arp architecture (.net) in the java world. A one stop
I am getting this error whenever my S#arp Architecture attempts to start and this
In my latest project I use GetIpNetTable for accessing the Windows ARP-Table from C#
I've added NHibernate.Search to my otherwise routine S#arp Architecture 2.0 / MVC3 / .Net

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.