Lazy loading - Medium trust

12 views
Skip to first unread message

Dryadwoods

unread,
Nov 6, 2009, 4:49:33 PM11/6/09
to Castle Project Users
Hello,

I downloaded http://www.castleproject.org/download/activerecord/v1rc1/InitializingAndConfiguring.zip
Created my classes and I am using lazy loading.
On localhost all is running fine but on my hosting provider's server
the lazy loading isn't working (medium trust), all the rest is
working.

How can I solve this problem?

Thanks.

Krzysztof Koźmic

unread,
Nov 7, 2009, 3:13:26 AM11/7/09
to castle-pro...@googlegroups.com
can yoube more specific?

What do you mean it's not working?
You get an exception?
Paste us the exception.

Krzysztof

Dryadwoods

unread,
Nov 7, 2009, 12:38:52 PM11/7/09
to Castle Project Users
In the controller I'm doing something like:

MyObject myObj = MyObject.Find(id);
Return(myObj)

Then in the view I'm trying to access some "child attribute":

<%= Model.MyChild.Name %>

Initializing[......]-failed to lazily initialize a collection of
role: ........ , no session or session was closed
Exception Details: NHibernate.LazyInitializationException:

This is happening on my hosting provider's server. In localhost this
is working without problems,

Any ideas?

Thanks


On Nov 7, 9:13 am, Krzysztof Koźmic <krzysztof.koz...@gmail.com>
wrote:
> can yoube more specific?
>
> What do you mean it's not working?
> You get an exception?
> Paste us the exception.
>
> Krzysztof
>
>
>
> Dryadwoods wrote:
> > Hello,
>
> > I downloadedhttp://www.castleproject.org/download/activerecord/v1rc1/Initializing...

Krzysztof Koźmic

unread,
Nov 7, 2009, 1:30:57 PM11/7/09
to castle-pro...@googlegroups.com
This does not look anything like issue with medium trust.

The error message is standard message NHibernate throws when you're trying to access lazily-loaded collection after you close the session.
There must be something you're doing differently.

Krzysztof

Sandro Micael

unread,
Nov 7, 2009, 1:47:07 PM11/7/09
to castle-pro...@googlegroups.com
I'm running exactly the same code in my computer and on the server. Then why is it working in one and not on the other?

José F. Romaniello

unread,
Nov 7, 2009, 2:06:47 PM11/7/09
to Castle Project Users
Check, if you are using a session-per-request, if the IHtppModule is
in the server too, if you have the web.config properly configured in
the server and so on.
As Krzysztof said is an standard nhibernate exception.


On 7 nov, 15:47, Sandro Micael <sandromic...@gmail.com> wrote:
> I'm running exactly the same code in my computer and on the server. Then why
> is it working in one and not on the other?
>
> The error message is standard message NHibernate throws when you're trying
>
>
>
> > to access lazily-loaded collection after you close the session.
> > There must be something you're doing differently.
>
> > Krzysztof
>
> > Dryadwoods wrote:
>
> > In the controller I'm doing something like:
>
> > MyObject myObj = MyObject.Find(id);
> > Return(myObj)
>
> > Then in the view I'm trying to access some "child attribute":
>
> > <%= Model.MyChild.Name %>
>
> > Initializing[......]-failed to lazily initialize a collection of
> > role: ........ , no session or session was closed
> > Exception Details: NHibernate.LazyInitializationException:
>
> > This is happening on my hosting provider's server. In localhost this
> > is working without problems,
>
> > Any ideas?
>
> > Thanks
>
> > On Nov 7, 9:13 am, Krzysztof Koźmic <krzysztof.koz...@gmail.com> <krzysztof.koz...@gmail.com>

Dryadwoods

unread,
Nov 8, 2009, 10:20:52 AM11/8/09
to Castle Project Users
I'm using the configuration as showed in here:
http://www.castleproject.org/activerecord/documentation/v1rc1/usersguide/web.html#usingSessionScopeWebModule

<system.web>
<httpModules>
<add
name="ar.sessionscope"
type="Castle.ActiveRecord.Framework.SessionScopeWebModule,
Castle.ActiveRecord" />
</httpModules>
</system.web>

That is the only thing I've.
What am I missing?
Reply all
Reply to author
Forward
0 new messages