-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Because of security restrictions, the type NHibernate.Collec
PostPosted: Wed Dec 07, 2005 8:57 am 
I use nhibernate in windows application over Net Remoting. Starting with 1.0.1.0 ( last working version was 0.99.1) the folowing error has trow:

System.Runtime.Serialization.SerializationException: Because of security restrictions, the type NHibernate.Collection.Bag cannot be accessed. ---> System.Security.SecurityException: Request failed.
at System.Security.SecurityRuntime.FrameDescSetHelper(FrameSecurityDescriptor secDesc, PermissionSet demandSet, PermissionSet& alteredDemandSet)
at System.Runtime.Serialization.FormatterServices.nativeGetSafeUninitializedObject(RuntimeType type)
at System.Runtime.Serialization.FormatterServices.GetSafeUninitializedObject(Type type)
--- End of inner exception stack trace ---

Server stack trace:
at System.Runtime.Serialization.FormatterServices.GetSafeUninitializedObject(Type type)
at System.Runtime.Serialization.Formatters.Soap.ObjectReader.ParseObject(ParseRecord pr)
at System.Runtime.Serialization.Formatters.Soap.ObjectReader.Parse(ParseRecord pr)
at System.Runtime.Serialization.Formatters.Soap.SoapHandler.StartChildren()
at System.Runtime.Serialization.Formatters.Soap.SoapParser.ParseXml()
at System.Runtime.Serialization.Formatters.Soap.SoapParser.Run()
at System.Runtime.Serialization.Formatters.Soap.ObjectReader.Deserialize(HeaderHandler handler, ISerParser serParser)
at System.Runtime.Serialization.Formatters.Soap.SoapFormatter.Deserialize(Stream serializationStream, HeaderHandler handler)
at System.Runtime.Remoting.Channels.CoreChannel.DeserializeSoapRequestMessage(Stream inputStream, Header[] h, Boolean bStrictBinding, TypeFilterLevel securityLevel)
at System.Runtime.Remoting.Channels.SoapServerFormatterSink.ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)


Top
  
 
 Post subject:
PostPosted: Wed Dec 07, 2005 11:56 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Looks like a bug, please add it to JIRA.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 08, 2005 5:03 am 
Senior
Senior

Joined: Thu Aug 25, 2005 3:35 am
Posts: 160
no it is not.
finally I can help :lol:

Since sp2, Microsoft has raised the security on remoting. Therefor, some things don't work anymore.
Luckily, I found out that you can set a property to relax those security restrains back to the pre-SP2 era.

At your server, You have to set the typefilter to "Full".
This is how I start my server:
Code:
         BinaryServerFormatterSinkProvider serverFormatterSinkProvider = new BinaryServerFormatterSinkProvider();
         serverFormatterSinkProvider.TypeFilterLevel = TypeFilterLevel.Full;

         IDictionary props = new Hashtable();
         props["port"] = 1200;

         TcpChannel chnl = new TcpChannel(props, null, serverFormatterSinkProvider);
         ChannelServices.RegisterChannel(chnl);


I hope this helps!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 09, 2005 2:52 pm 
Thanx for replay, but it not work. I already use this in server.config file:

<serverProviders>
<formatter ref="soap" typeFilterLevel="Full" />
<formatter ref="binary" typeFilterLevel="Full" />
</serverProviders>

Whitout this the communication is not posible. The problem come when I try to send from remote aplication an object that contain <NHibernate.Bag> collection.

Let say the following objects:
class User{
int Id
string Name
string Pass
IList Addresses}

and

Address{
int Id
string Street
string No
User User}

When I get object user from remote server, work ok. But when I send back the same object I'we got the security error

Can help somebody?


Top
  
 
 Post subject:
PostPosted: Sat Dec 10, 2005 5:56 am 
Senior
Senior

Joined: Thu Aug 25, 2005 3:35 am
Posts: 160
i'm very sorry to hear that. I do not understand why it did not help, I had the exact same stacktrace (if I remember correctly).


Top
 Profile  
 
 Post subject: Problem solved
PostPosted: Thu Jan 26, 2006 2:35 pm 
Newbie

Joined: Thu Jan 26, 2006 2:11 pm
Posts: 1
I can't reproduce this error with a test case, but I found a way to fix.
After I google a lot, a post from Adam Sills
(http://surrealization.com/archive/2003/08/12/5096.aspx)
solve my problems.
You must include this attribute in Assembly.cs
[assembly: System.Security.AllowPartiallyTrustedCallers]

I've got the same probleme with Nullabes objects.

_________________
civanovici


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.