Serializing Objects with a Strong Name

  • Thread starter Thread starter Rob Harrop
  • Start date Start date
R

Rob Harrop

I am trying to pass some M-By-Val objects across a
Remoting channel. They work fine when I remove the strong
name from the assembly but I get errors when I add the
strong name to the assembly.

I need to have the strong name on this assembly
 
Hi Rob,

Thanks for contacting Microsoft Community Support.

You fail to pass some marshal by value objects across a Remoting channel if
the objects have Strong Names. I have performed some research and not found
such an issue so far. I am performing further research/tests and will
update you with my findings here.

In the meantime, to isolate the problem from any custom code issues, you
can follow the following article to see if the problem occurs in the sample
projects:

HOW TO: Marshal an Object to a Remote Server by Value by Using Visual C#
NET.
http://support.microsoft.com/default.aspx?scid=KB;EN-US;307546


Best regards,
Perry Deng
Microsoft

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Rob,

In my test projects created by following the previous Knowledge Base
article in VS.NET 2003, if the object type being transferred to the server
has a strong name, the following error occurs:

System.Runtime.Serialization.SerializationException: Because of security
restrictions, the type ServerClassValue.ForwardMe cannot be accessed. --->
System.Security.SecurityException: Request failed.

In .NET Framework 1.1, there are some security enhancements. By default, a
strong-named assembly can be called only by other assemblies that are
granted full trust by security policy. You can use the
AllowPartiallyTrustedCallersAttribute attribute to explicitly allow the
assembly use by partially trusted code.

The remoting application works well after adding the following code in the
assembly of the object type being transferred:
[assembly: AllowPartiallyTrustedCallers]

You can refer to the following article for more information:
AllowPartiallyTrustedCallersAttribute Class
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfSystemSecurityAllowPartiallyTrustedCallersAttributeClassTopic.asp

Best regards,
Perry Deng
Microsoft

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top