Problems using Serializable attribute
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.remoting.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

Henke
Hi!
I read in MSDN that an object could be marshaled by value just be mark it
[Serializable]. When I do this and tries to invoke a method on the object I
get this exception:

An unhandled exception of type 'System.Runtime.Remoting.RemotingException'
occurred in mscorlib.dll
Additional information: Trying to create a proxy to an unbound type.

If I derive the class from MarshalByRefObject everything works fine. I don't
do any changes in my configuration files.

Can some one please tell what's wrong here?
/Henke

Reply to this message...
 
    
Raghavendra T V
Hi Henke,

From the error you posted its quite difficult to figure out the exact error.
may be you can post the piece of code that is crashing the application.

Anyways here are the list of common remoting errors.

Common Remoting Errors.
1.You Register the channel with a specific port and forget to unregister it
once the use of it is over.
2.Trying to connect to wrong port.
3.By default Remoting Takes the remoting channel name as TCP (if you use TCP
Channel) and you are trying to use the same name for channel again. in your
code.

Hope this helps you.

Thanks
Raghavendra

"Henke" <Click here to reveal e-mail address> wrote in message
news:uEGYpq$Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Henke (VIP)
Hi!
Here's some code...
My Global.asax:
protected void Application_Start(Object sender, EventArgs e)
{
// Configure remoting
BinaryClientFormatterSinkProvider clientProvider = new
BinaryClientFormatterSinkProvider();
BinaryServerFormatterSinkProvider serverProvider = new
BinaryServerFormatterSinkProvider();
serverProvider.TypeFilterLevel = TypeFilterLevel.Full;

System.Collections.IDictionary props = new System.Collections.Hashtable();
props["port"] = 2100;                
string channelName = System.Guid.NewGuid().ToString();
props["name"] = channelName;
props["typeFilterLevel"] = TypeFilterLevel.Full;
bllChannel = new TcpChannel(props, clientProvider, serverProvider);
ChannelServices.RegisterChannel(bllChannel);            
}

Where I use it:
BaseObject retObject = Activator.GetObject(typeof(CustomerManager),
"tcp://comp00569:2099/CustomerManager");
CustomerList customers = retObject.GetCustomers();

/Henke

"Raghavendra T V" wrote:

[Original message clipped]

Reply to this message...
 
    
Sam Santiago
You are hosting your remote object in IIS it seems since your code is in the
Application_Start event. You CANNOT use the TCP channel within IIS. You
can have binary formatting though. Check out this link:

Hosting Remote Objects in Internet Information Services (IIS)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconhostingremoteobjectsininternetinformationservicesiis.asp

Here's an excerpt:

"you cannot do any of the following:
- Specify an application name when hosting in IIS. The name of the virtual
directory becomes your application name.
- Use the <debug> element in a Web.config file that is used for .NET
remoting configuration.
- Use any channel other than the HttpChannel.
- Use the Web.config file and the <client> element to configure your client
Web application automatically. If you want to use IIS as a remoting client,
you must call RemotingConfiguration.Configure in the Application_Start
method in the Global.asax file"

Thanks,

Sam

--
_______________________________
Sam Santiago
Click here to reveal e-mail address
http://www.SoftiTechture.com
_______________________________
"Henke" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Henke (VIP)
Thanks again for your answer.
The thing is that I'm not hosting the objects on IIS, it's is the
WebApplication that uses remote objects to get data from a back-end server.

/Henke

"Sam Santiago" wrote:

[Original message clipped]

Reply to this message...
 
    
Sam Santiago
Just checking the obvious. Are you deploying your remote object assembly
with your ASP.NET application? Or are you using an interface that your
ASP.NET application has access to? Essentially, are you taking care of
step#5 in this list:

Basic Remoting Task List
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconBasicRemotingTaskList.asp

Thanks,

Sam

--
_______________________________
Sam Santiago
Click here to reveal e-mail address
http://www.SoftiTechture.com
_______________________________
"Henke" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Henke (VIP)
Actually I am deploying my object assembly with my ASP.NET application right
now. But I'm aware that I should deploy interfaces instead. I will do it in
the future.
To answer your question I don't fully take care of step 5.

/Henke

"Sam Santiago" wrote:

[Original message clipped]

Reply to this message...
 
 
System.Activator
System.Collections.Hashtable
System.Collections.IDictionary
System.EventArgs
System.Guid
System.MarshalByRefObject
System.Runtime.Remoting.Channels.BinaryClientFormatterSinkProvider
System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider
System.Runtime.Remoting.Channels.ChannelServices
System.Runtime.Remoting.Channels.Http.HttpChannel
System.Runtime.Remoting.Channels.Tcp.TcpChannel
System.Runtime.Remoting.RemotingConfiguration
System.Runtime.Remoting.RemotingException
System.Runtime.Serialization.Formatters.TypeFilterLevel




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com