[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.remoting

Problems using Serializable attribute

Henke

8/27/2004 5:55:00 AM

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


5 Answers

Raghavendra T V

8/27/2004 7:27:00 AM

0

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" <henke_nord@hotmail.com> wrote in message
news:uEGYpq$iEHA.396@TK2MSFTNGP12.phx.gbl...
> 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
>
>


Henke

8/31/2004 7:37:00 AM

0

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:

> 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" <henke_nord@hotmail.com> wrote in message
> news:uEGYpq$iEHA.396@TK2MSFTNGP12.phx.gbl...
> > 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
> >
> >
>
>
>

Sam Santiago

8/31/2004 4:00:00 PM

0

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/cpconhostingremoteobjectsininternetinformationservi...

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
ssantiago@n0spam-SoftiTechture.com
http://www.SoftiTe...
_______________________________
"Henke" <Henke@discussions.microsoft.com> wrote in message
news:CF29671E-9058-48BB-A3E7-3B2EAF27E3C3@microsoft.com...
> 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:
>
> > 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" <henke_nord@hotmail.com> wrote in message
> > news:uEGYpq$iEHA.396@TK2MSFTNGP12.phx.gbl...
> > > 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
> > >
> > >
> >
> >
> >


Sam Santiago

8/31/2004 10:17:00 PM

0

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/cpconBasicRemotingTa...

Thanks,

Sam

--
_______________________________
Sam Santiago
ssantiago@n0spam-SoftiTechture.com
http://www.SoftiTe...
_______________________________
"Henke" <Henke@discussions.microsoft.com> wrote in message
news:1698434A-FD50-4B82-BC1E-83913AE83284@microsoft.com...
> 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:
>
> > 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/cpconhostingremoteobjectsininternetinformationservi...
> >
> > 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
> > ssantiago@n0spam-SoftiTechture.com
> > http://www.SoftiTe...
> > _______________________________
> > "Henke" <Henke@discussions.microsoft.com> wrote in message
> > news:CF29671E-9058-48BB-A3E7-3B2EAF27E3C3@microsoft.com...
> > > 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:
> > >
> > > > 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" <henke_nord@hotmail.com> wrote in message
> > > > news:uEGYpq$iEHA.396@TK2MSFTNGP12.phx.gbl...
> > > > > 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
> > > > >
> > > > >
> > > >
> > > >
> > > >
> >
> >
> >


Henke

9/1/2004 9:45:00 AM

0

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:

> 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/cpconBasicRemotingTa...
>
> Thanks,
>
> Sam
>
> --
> _______________________________
> Sam Santiago
> ssantiago@n0spam-SoftiTechture.com
> http://www.SoftiTe...
> _______________________________
> "Henke" <Henke@discussions.microsoft.com> wrote in message
> news:1698434A-FD50-4B82-BC1E-83913AE83284@microsoft.com...
> > 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:
> >
> > > 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/cpconhostingremoteobjectsininternetinformationservi...
> > >
> > > 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
> > > ssantiago@n0spam-SoftiTechture.com
> > > http://www.SoftiTe...
> > > _______________________________
> > > "Henke" <Henke@discussions.microsoft.com> wrote in message
> > > news:CF29671E-9058-48BB-A3E7-3B2EAF27E3C3@microsoft.com...
> > > > 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:
> > > >
> > > > > 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" <henke_nord@hotmail.com> wrote in message
> > > > > news:uEGYpq$iEHA.396@TK2MSFTNGP12.phx.gbl...
> > > > > > 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
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > >
> > >
> > >
>
>
>