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 6547527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:50:31+00:00 2026-05-25T11:50:31+00:00

Using S#arp Architecture 2.3 RC , I am trying to publish two websites which

  • 0

Using S#arp Architecture 2.3 RC, I am trying to publish two websites which use -mostly- the same codebase. The first of the applications I publish runs correctly, however, upon deploying and trying to run the second application, I get the following exception:

Access to the path 'C:\Windows\TEMP\nhibernate.current_session--851346262.bin' is denied.

When I refresh the window, I then get this exception:

A session factory has already been configured with the key of nhibernate.current_session

I have even tried loading them in separate Application Pools and the error persists. I don’t understand how is it that my two applications’ sessions are colliding on IIS, whereas they run just fine with Visual Studio.

FYI, I am trying to run them on Windows Server 2008 R2 + IIS 7.5

Any help?

  • 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-25T11:50:32+00:00Added an answer on May 25, 2026 at 11:50 am

    It looks like S#arp Architecture tries to use the same NHibernate session factory for both applications. It maybe colliding because it uses the same default ‘factory key’ (nhibernate.current_session) for both web apps when it persists configuration on disk. Should you be using different ‘factory keys’? In order to do this you can read the FAQ section about multiple databases (although you don’t have multiple databases, your solution may be the same):

    Q: How do I add support for multiple databases?

    A:: To add support for an additional database to your project:

    Create an NHibernateForOtherDb.config file which contains the
    connection string to the new database

    Within YourProject.Web.Mvc/Global.asax.cs, immediately under the
    NHibernateSession.Init() to initialize the first session factory, an
    additional call to NHibernateSession.AddConfiguration(). While the
    first NHibernate initialization assumes a default factory key, you’ll
    need to provide an explicit factory key for the 2nd initialization.
    This factory key will be referred to by repositories which are tied to
    the new database as well…

    Looking at S#arp sources I found that they use following logic to create file on disk:

        var fileName = string.Format(
            "{0}-{1}.bin", 
            configKey, 
            Assembly.GetCallingAssembly().CodeBase.GetHashCode());
    

    So if you don’t want to change config/factory key you can try calling this code from different assembly.

    EDIT:

    It looks like NHibernateSession.Init does not take overload that lets you specify factory key. But it has other public methods that you can call instead of Init:

    NHibernateSession.InitStorage(storage);
    try {
        NHibernateSession.AddConfiguration("%PUT YOUR OWN FACTORY KEY%", ...);
    } catch {
        NHibernateSession.Storage = null;
        throw;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have started using the s#arp architecture which uses FNhibernate and GeneratedBy.HiLo to generate
I have just started to use the newest version of S#arp Architecture 1.9.5, which
I am trying to get a simple prototype using ASP.NET S#arp-architecture (Sharp architecture) to
I'm building an ecommerce site using S#arp Architecture. I'm trying to map a hierachy
I've been playing around with creating an application using the S#arp Architecture . One
Using PyObjC , you can use Python to write Cocoa applications for OS X.
I'm using the S#arp Architecture . I can't remember where I read it, but
I am using the s#arp framework and want to use the latest mvc contrib.
Using S#arp Architecture 1.0RC... I have a controller that never seems to update one
I am using S#arp architecture with Fluent Nhibernate and Automapper on a legacy DB.

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.