I am set up for session per web request, and every single tiny thing
gets a session.  Did I set something up wrong or is this normal?  In
nhprof I can see 8 session created for a home page which doesn't even
call for a session.  Things like /Scripts/jquery.js, /Content/
image1.jpg, favicon.ico all get a session.

In global.asax:
        public static ISessionFactory SessionFactory =
CreateSessionFactory();
        public MvcApplication()
        {
            BeginRequest += MvcApplication_BeginRequest;
            EndRequest += MvcApplication_EndRequest;
        }

        void MvcApplication_BeginRequest(object sender, EventArgs e)
        {
            if (HttpContext.Current.Items["CurrentSession"] == null)
            {
                HttpContext.Current.Items["CurrentSession"] =
SessionFactory.OpenSession();
            }
        }

        void MvcApplication_EndRequest(object sender, EventArgs e)
        {
            var session =
(ISession)HttpContext.Current.Items["CurrentSession"];

            if (session != null)
            {
                session.Dispose();
            }
        }

IoC container returns session as it's needed:
 
kernel.Bind<ISession>().ToConstant((ISession)HttpContext.Current.Items["CurrentSession"]);

I put a screenshot of nhprof screen up showing all of the spawned
sessions, you can see it here (https://picasaweb.google.com/rhartzog/
NhSetup?authkey=Gv1sRgCJ23-Pqi_djZlwE#5590318316646382866).  Any help
would be appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to