473,699 Members | 2,615 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Remoting client exception

Hi,

I'm using the remoting, and I have a remoting object that has a public event
that other processes should register to it.
But when the client process is registering to the remote event, it throw the
following exception:
System.Runtime. Serialization.S erializationExc eption {“Cannot find the
assembly Tester, Version=1.0.216 4.27180, Culture=neutral ,
PublicKeyToken= null.”}

Note: The Tester assembly that contains the Tester class at the code below,
is the remote client process that tries to register to the event at the
Remoting object.

Here the code:

//////////////////////////////////////////////////////////////////
// The server process that export a remoting object
public class RemotingManager
{
private int m_port;
private TcpChannel m_Channel = null;
private MyRemoting m_remotingObj = null;

public RemotingManager (int port)
{
m_port = port;
BinaryServerFor matterSinkProvi der serverProvider = new
BinaryServerFor matterSinkProvi der();
serverProvider. TypeFilterLevel = TypeFilterLevel .Full;
IDictionary props = new Hashtable();
props["port"] = "9898";
props["name"] = "Gci:" + m_port.ToString ();
props["typeFilterLeve l"] = TypeFilterLevel .Full;
m_Channel = new TcpChannel(prop s, null, serverProvider) ;
ChannelServices .RegisterChanne l(m_Channel);
m_remotingObj = new GciRemoteViewer ();
RemotingService s.Marshal(m_rem otingObj, "MyUri");
}
}

[Serializable()]
public delegate void MyEventHandler( );

public class RemoteObject : MarshalByRefObj ect
{
public event MyEventHandler MyHandler;

public RemoteObject() {}

public void SomeMethod()
{
if( MyHandler != null )
MyHandler();
}

public override Object InitializeLifet imeService()
{ // By returning a null reference it tells the .NET remoting system
// that instances of this type are intended to have an infinite lifetime.
return null;
}
}

////////////////////////////////////////////////////////////////////////////////////////////
// The following code is at the client side process that get the proxy object.

public class Tester
{
public Tester()
{
TcpChannel channel = new TcpChannel(0); // No real need for that.
ChannelServices .RegisterChanne l(channel ); // No real need for that.
// or: ChannelServices .RegisterChanne l(new TcpChannel()); // No real need
for that.
RemoteObject remoteObject =
(RemoteObject)A ctivator.GetObj ect(typeof(Remo teObject),
"tcp://localhost:9898/MyUri");
if( remoteObject == null )
// ERROR !!!
else
{
// The following line throws the error !!!!
remoteObject.My Handler += new
GciViewerAPI.My EventHandler(th is.HandlingMeth od);
}
}

public void HandlingMethod( )
{
// Doing somthing...
}
}
////////////////////////////////////////////////////////////////////////////////////////////

Can anybody tell me what why?
-------
Thanks
Sharon
Dec 4 '05 #1
4 2258
Hi Sharon,
Hi Sharon,

Welcome to MSDN newsgroup.
Regarding on the "assembly not found ...." error when using remote event
handler in .net remoting application.... it is an expected behavior because
when we register a event handler of an remote object (SAO) in our client
application, our client class object(which expose that event handler
fucntion) will be dynamically invoked by the server object (when event is
fired...), in other word, the client object is acting as a server object
also( from the server object's perspective.... .). So when the event fired,
the server object will try to find the metadata (assembly) of the client
class object, then "assembly not found exception" thrown out....

So to resolve the problem, we have to make the client object which expose
the event handler function also marshalByRef so that it can act as a server
object..... And there are some guys which use a certain shim class which
expose such event handler fucntions and act as a intermediate connectore
between our client app and server object (SAO)...

Here is a web article which mentioned such topic and provide an example
about using a shim class....

#Events and .NET Remoting
http://www.tomergabel.com/Events+And+NET+Remoting.aspx

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| Thread-Topic: Remoting client exception
| thread-index: AcX414gSBEN0uOT jQp2+XkZ7F7FZkQ ==
| X-WBNR-Posting-Host: 199.203.93.141
| From: =?Utf-8?B?U2hhcm9u?= <Sh*****@newsgr oups.nospam>
| Subject: Remoting client exception
| Date: Sun, 4 Dec 2005 05:35:03 -0800
| Lines: 100
| Message-ID: <DE************ *************** *******@microso ft.com>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 8bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GXA03.phx.gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.langua ges.csharp:3692 60
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
|
| Hi,
|
| I'm using the remoting, and I have a remoting object that has a public
event
| that other processes should register to it.
| But when the client process is registering to the remote event, it throw
the
| following exception:
| System.Runtime. Serialization.S erializationExc eption {“Cannot find the
| assembly Tester, Version=1.0.216 4.27180, Culture=neutral ,
| PublicKeyToken= null.”}
|
| Note: The Tester assembly that contains the Tester class at the code
below,
| is the remote client process that tries to register to the event at the
| Remoting object.
|
| Here the code:
|
| //////////////////////////////////////////////////////////////////
| // The server process that export a remoting object
| public class RemotingManager
| {
| private int m_port;
| private TcpChannel m_Channel = null;
| private MyRemoting m_remotingObj = null;
|
| public RemotingManager (int port)
| {
| m_port = port;
| BinaryServerFor matterSinkProvi der serverProvider = new
| BinaryServerFor matterSinkProvi der();
| serverProvider. TypeFilterLevel = TypeFilterLevel .Full;
| IDictionary props = new Hashtable();
| props["port"] = "9898";
| props["name"] = "Gci:" + m_port.ToString ();
| props["typeFilterLeve l"] = TypeFilterLevel .Full;
| m_Channel = new TcpChannel(prop s, null, serverProvider) ;
| ChannelServices .RegisterChanne l(m_Channel);
| m_remotingObj = new GciRemoteViewer ();
| RemotingService s.Marshal(m_rem otingObj, "MyUri");
| }
| }
|
| [Serializable()]
| public delegate void MyEventHandler( );
|
| public class RemoteObject : MarshalByRefObj ect
| {
| public event MyEventHandler MyHandler;
|
| public RemoteObject() {}
|
| public void SomeMethod()
| {
| if( MyHandler != null )
| MyHandler();
| }
|
| public override Object InitializeLifet imeService()
| { // By returning a null reference it tells the .NET remoting system
| // that instances of this type are intended to have an infinite
lifetime.
| return null;
| }
| }
|
////////////////////////////////////////////////////////////////////////////
////////////////
| // The following code is at the client side process that get the proxy
object.
|
| public class Tester
| {
| public Tester()
| {
| TcpChannel channel = new TcpChannel(0); // No real need for that.
| ChannelServices .RegisterChanne l(channel ); // No real need for that.
| // or: ChannelServices .RegisterChanne l(new TcpChannel()); // No real
need
| for that.
| RemoteObject remoteObject =
| (RemoteObject)A ctivator.GetObj ect(typeof(Remo teObject),
| "tcp://localhost:9898/MyUri");
| if( remoteObject == null )
| // ERROR !!!
| else
| {
| // The following line throws the error !!!!
| remoteObject.My Handler += new
| GciViewerAPI.My EventHandler(th is.HandlingMeth od);
| }
| }
|
| public void HandlingMethod( )
| {
| // Doing somthing...
| }
| }
////////////////////////////////////////////////////////////////////////////
////////////////
|
| Can anybody tell me what why?
|
|
| -------
| Thanks
| Sharon
|

Dec 5 '05 #2
Hi Sharon,

Does my suggestion in last reply helps a little? If there're anything else
we can help, please feel free to post here.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| X-Tomcat-ID: 160995001
| References: <DE************ *************** *******@microso ft.com>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: st*****@online. microsoft.com (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Mon, 05 Dec 2005 09:56:15 GMT
| Subject: RE: Remoting client exception
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
| Message-ID: <HM************ **@TK2MSFTNGXA0 2.phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| Lines: 140
| Path: TK2MSFTNGXA02.p hx.gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.langua ges.csharp:3693 66
| NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
|
| Hi Sharon,
|
|
| Hi Sharon,
|
| Welcome to MSDN newsgroup.
| Regarding on the "assembly not found ...." error when using remote event
| handler in .net remoting application.... it is an expected behavior
because
| when we register a event handler of an remote object (SAO) in our client
| application, our client class object(which expose that event handler
| fucntion) will be dynamically invoked by the server object (when event is
| fired...), in other word, the client object is acting as a server object
| also( from the server object's perspective.... .). So when the event
fired,
| the server object will try to find the metadata (assembly) of the client
| class object, then "assembly not found exception" thrown out....
|
| So to resolve the problem, we have to make the client object which expose
| the event handler function also marshalByRef so that it can act as a
server
| object..... And there are some guys which use a certain shim class
which
| expose such event handler fucntions and act as a intermediate connectore
| between our client app and server object (SAO)...
|
| Here is a web article which mentioned such topic and provide an example
| about using a shim class....
|
| #Events and .NET Remoting
| http://www.tomergabel.com/Events+And+NET+Remoting.aspx
|
| Thanks,
|
| Steven Cheng
| Microsoft Online Support
|
| Get Secure! www.microsoft.com/security
| (This posting is provided "AS IS", with no warranties, and confers no
| rights.)
|
|
|
|
|
| --------------------
| | Thread-Topic: Remoting client exception
| | thread-index: AcX414gSBEN0uOT jQp2+XkZ7F7FZkQ ==
| | X-WBNR-Posting-Host: 199.203.93.141
| | From: =?Utf-8?B?U2hhcm9u?= <Sh*****@newsgr oups.nospam>
| | Subject: Remoting client exception
| | Date: Sun, 4 Dec 2005 05:35:03 -0800
| | Lines: 100
| | Message-ID: <DE************ *************** *******@microso ft.com>
| | MIME-Version: 1.0
| | Content-Type: text/plain;
| | charset="Utf-8"
| | Content-Transfer-Encoding: 8bit
| | X-Newsreader: Microsoft CDO for Windows 2000
| | Content-Class: urn:content-classes:message
| | Importance: normal
| | Priority: normal
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| | NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.2.250
| | Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GXA03.phx.gbl
| | Xref: TK2MSFTNGXA02.p hx.gbl
| microsoft.publi c.dotnet.langua ges.csharp:3692 60
| | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
| |
| | Hi,
| |
| | I'm using the remoting, and I have a remoting object that has a public
| event
| | that other processes should register to it.
| | But when the client process is registering to the remote event, it
throw
| the
| | following exception:
| | System.Runtime. Serialization.S erializationExc eption {“Cannot find the
| | assembly Tester, Version=1.0.216 4.27180, Culture=neutral ,
| | PublicKeyToken= null.”}
| |
| | Note: The Tester assembly that contains the Tester class at the code
| below,
| | is the remote client process that tries to register to the event at the
| | Remoting object.
| |
| | Here the code:
| |
| | //////////////////////////////////////////////////////////////////
| | // The server process that export a remoting object
| | public class RemotingManager
| | {
| | private int m_port;
| | private TcpChannel m_Channel = null;
| | private MyRemoting m_remotingObj = null;
| |
| | public RemotingManager (int port)
| | {
| | m_port = port;
| | BinaryServerFor matterSinkProvi der serverProvider = new
| | BinaryServerFor matterSinkProvi der();
| | serverProvider. TypeFilterLevel = TypeFilterLevel .Full;
| | IDictionary props = new Hashtable();
| | props["port"] = "9898";
| | props["name"] = "Gci:" + m_port.ToString ();
| | props["typeFilterLeve l"] = TypeFilterLevel .Full;
| | m_Channel = new TcpChannel(prop s, null, serverProvider) ;
| | ChannelServices .RegisterChanne l(m_Channel);
| | m_remotingObj = new GciRemoteViewer ();
| | RemotingService s.Marshal(m_rem otingObj, "MyUri");
| | }
| | }
| |
| | [Serializable()]
| | public delegate void MyEventHandler( );
| |
| | public class RemoteObject : MarshalByRefObj ect
| | {
| | public event MyEventHandler MyHandler;
| |
| | public RemoteObject() {}
| |
| | public void SomeMethod()
| | {
| | if( MyHandler != null )
| | MyHandler();
| | }
| |
| | public override Object InitializeLifet imeService()
| | { // By returning a null reference it tells the .NET remoting system
| | // that instances of this type are intended to have an infinite
| lifetime.
| | return null;
| | }
| | }
| |
|
////////////////////////////////////////////////////////////////////////////
| ////////////////
| | // The following code is at the client side process that get the proxy
| object.
| |
| | public class Tester
| | {
| | public Tester()
| | {
| | TcpChannel channel = new TcpChannel(0); // No real need for that.
| | ChannelServices .RegisterChanne l(channel ); // No real need for that.
| | // or: ChannelServices .RegisterChanne l(new TcpChannel()); // No real
| need
| | for that.
| | RemoteObject remoteObject =
| | (RemoteObject)A ctivator.GetObj ect(typeof(Remo teObject),
| | "tcp://localhost:9898/MyUri");
| | if( remoteObject == null )
| | // ERROR !!!
| | else
| | {
| | // The following line throws the error !!!!
| | remoteObject.My Handler += new
| | GciViewerAPI.My EventHandler(th is.HandlingMeth od);
| | }
| | }
| |
| | public void HandlingMethod( )
| | {
| | // Doing somthing...
| | }
| | }
|
////////////////////////////////////////////////////////////////////////////
| ////////////////
| |
| | Can anybody tell me what why?
| |
| |
| | -------
| | Thanks
| | Sharon
| |
|
|

Dec 7 '05 #3
Yes, you did help.

--
Thanks
Sharon
Dec 12 '05 #4
You're welcome Sharon,

Please feel free to post here when you need any further assistance...

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| Thread-Topic: Remoting client exception
| thread-index: AcX/LE+uukYRGmtyRpi vX1CBwMda0A==
| X-WBNR-Posting-Host: 199.203.93.141
| From: =?Utf-8?B?U2hhcm9u?= <Sh*****@newsgr oups.nospam>
| References: <DE************ *************** *******@microso ft.com>
<HM************ **@TK2MSFTNGXA0 2.phx.gbl>
<Wz************ **@TK2MSFTNGXA0 2.phx.gbl>
| Subject: RE: Remoting client exception
| Date: Mon, 12 Dec 2005 06:57:03 -0800
| Lines: 5
| Message-ID: <0C************ *************** *******@microso ft.com>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GXA03.phx.gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.langua ges.csharp:3710 02
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
|
| Yes, you did help.
|
| --
| Thanks
| Sharon
|

Dec 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2919
by: Sean Newton | last post by:
I am absolutely bewildered by now by the Microsoft.Samples SSPI and Security assemblies. I've been trying to set these up in a very straightforward harness in the way that I'd like to be able to use them. No IIS. Use TCP, binary. Standard server example with a console host and console client. .NET 1.1, windows XP. (I tried posting to the remoting newsgroup, no answers in the last couple days, trying here in hopes that more people watch this...
3
4692
by: Deepal | last post by:
Hi; I'm doing an example program from a book regarding .NET Remoting. Both the Client and Server are C# Console Applications. Server Code is using System; using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Tcp;
6
2711
by: Uttam | last post by:
Hello, We are at a very crucial decision making stage to select between .Net and Java. Our requirement is to download a class at runtime on the client computer and execute it using remoting or rmi. Just to keep my question short I am posting trimmed version of my code. //file: Serializable.cs
0
3841
by: Mike Grishaber | last post by:
Hello All, I am using an IHttpAsyncHandler class to intercept HTTP Requests and forward them to a system which processes the Request and returns the Result. I use .NET Remoting to connect the IHttpAsyncHandler object to the System and transfer the Request and Result between the two. This works fine for quite a while, and then I start to get the following error. "This remoting proxy has no channel sink which means either the server has
4
3116
by: Uchiha Jax | last post by:
Hello everyone, I am a plenty silly person who is trying to learn .NET remoting through trial and error (all articles I read are going over my head at the moment (mostly) so I thought i'd give it a go). What I want to do is this: Have a server instance of the program, this server instance will receive communication from client programs (as demonstrated in the AddMessage()
1
2691
by: David Krmpotic | last post by:
Hi All! I have a .NET remoting Client-Server application with Server Activated Objects only.. something is worrying me.. sometimes (rarely), I can't connect to the server although it is running. I get the exception saying "A socket operation was attempted to an unreachable host".. it means that it behaves the same as if the server
0
2459
by: Martijn Damen | last post by:
Hi, At the moment I am trying to develop an application that uses another app over .net remoting and having some problems with it (ok, that is ofcourse why I am here), hope somebody can shine a light on the following: I have been given a sample winforms app, which works without problem, I can connect, send queries and become response from the other application. When I try to implement this in webforms, this unfortunately does not...
15
2402
by: Ron L | last post by:
We are working on a distributed VB.Net application which will access a SQL database located on a known server. Each client will run on the user's local machine. To implement this, we are trying to use remoting for our access to the SQL server, with the remoting being via IIS. Since all of our users will have accounts in the destination domain, we want to have IIS handle the security for us and not allow anonymous. We have set this up...
3
424
by: Mike9900 | last post by:
We need to get the correct error message from the .NET Remoting server on the another computer. When we use .NET Remoting the client does not receive correct SQL Server error message if the client is on the another computer. For example, if the client deleted a record in SQL Server and the SQL Server throw and exception, the exeption message is not sent to the client as the correct SQL Server message, instead the exception is either...
0
9033
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8911
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7748
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6533
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5872
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4375
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4627
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3057
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2345
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.