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

  • Home
  • SEARCH
  • 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 8881295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:19:01+00:00 2026-06-14T20:19:01+00:00

I am using a MVC4, C#, Castle Windsor, fluentnhibernate stack for my web application,

  • 0

I am using a MVC4, C#, Castle Windsor, fluentnhibernate stack for my web application, which generally works very well.

Its only occasionally that I get an error related to nHibernate something along the lines of:

Invalid attempt to call Read when reader is closed.

or

Internal connection fatal error.

This usually rears its ugly head when I do multiple calls, in very close succession.

Currently I am replicating it while doing multiple ajax gets, from JQuery.

What I suspect the problem is, is with my NHibernate session management.

The only thing I can think of is that the calls are someone using the same session, the first one completes and closes it, then the following call is unable to complete.

This shouldn’t be possible due to the way my sessions are handled like this:

Kernel.Register(
                Component.For<ISessionFactory>()
                                .UsingFactoryMethod(_ => config.BuildSessionFactory()),
                Component.For<ISession>()
                                .UsingFactoryMethod(k => k.Resolve<ISessionFactory>().OpenSession())
                                .LifestylePerWebRequest());

Should be one session per request right?

How else, or where else can I look for the problem? I am quite stuck.

  • 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-06-14T20:19:03+00:00Added an answer on June 14, 2026 at 8:19 pm

    Of course solved this a few minutes later, but the answer was an eye opener for me.

    This answer led me down the right path.

    While all of my Repositories, Manager and other layers were installed with the correct lifestyle using Castle Windsor, there was one that wasn’t.

    I was doing a Repository call from an ActionFilter, all of my action filters are invoked through an ActionInvoker class which was registered incorrectly as Singleton, which resulted in my errors.

    container.Register(Component.For<IActionInvoker>()
                                        .ImplementedBy<WindsorActionInvoker>()
                                        .LifeStyle.***Singleton***);
    

    Should of course be

    container.Register(Component.For<IActionInvoker>()
                                        .ImplementedBy<WindsorActionInvoker>()
                                        .LifeStyle.Transient);
    

    Just another reminder to pay closer attention to those Lifestyles.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using MVC4's WEB API to expose a controller. Initially I created created
I am building a Web API using MVC4 and some request return blocks of
I'm using latest MVC4-RC (.net 4.0) with Microsoft ASP.NET Web Optimization Framework http://nuget.org/packages/Microsoft.AspNet.Web.Optimization/1.0.0-beta3 and
I am creating a web api using asp.net mvc4 and the response output is
I have been writing an application using ASP.Net MVC4, where the majority of the
I'm using EF 4.3 in an MVC4 application and Ninject.MVC3. Controllers are MVCscaffolded using
I'm going to develop a web-based system with MVC4 which will use web services
I am using NServiceBus 3.2.7, Castle Windsor 3.1, and ASP.Net MVC 4. I am
I have a MVC4 application that is calling Amazon Web Services. The amazon service
I'm using MVC4 forms auth. My mobile web app runs in full screen UIwebview

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.