.comment-link {margin-left:.6em;}

Ben Cops

Tuesday, November 09, 2004

Remoting issues with strongly named assemblies

All your assemblies are strongly named, because BTS wants them all in the GAC, right?

Therefore you'll run into this issue if you try to remote them and need to serialise (byref) your types as parameters:

System.Runtime.Serialization.SerializationException : Because of security restrictions, the type [classname] cannot be accessed.
This is new to .net 1.1.
This guy has the answer. Essentially you need to mark the serialised class as follows


//The following attribute specifies that we are happy for this assembly to be remoted
//(serialised, anyway) - in .net version 1.1 a security check is added for strongly named
//types that means that deserialisation is disallowed unless either the deserialised class's assembly
//"Allow[s]PartiallyTrustedCallers", or the typeFilterLevel of the server/deserializer set to Full.
[assembly: AllowPartiallyTrustedCallers]


0 Comments:

Post a Comment

<< Home