Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Puzzling Remoting Exception

Posted on 2002-07-15
12
Medium Priority
?
395 Views
Last Modified: 2012-05-04
I'm trying to get my feet wet with remoting in VB.NET.

My client app has called the server app and is about to (I think) instantiate an object when it gets this error:

> An unhandled exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
> Additional information:  File or assembly name MyWinClient, or one of its dependencies, was not found.

This occurs as my WinClient test app attempts to make this call:

'** in MyWinClient.exe.  This fails with above error.
oMyNotifier = _
   Activator.GetObject( _
   GetType(SomeLib.MyNotifierClass), _
   "tcp://MOSCOW:8082/Test1" _
   )

(Note that I can't use "localhost" because of my network's configs, for some reason, so the name of my PC ("MOSCOW") is what I have to use with ASP and such.)

I really think that this problem is somehow related to this problem with a C# walkthrough:

   http://support.microsoft.com/default.aspx?scid=kb;EN-US;q312114

But I can't see what code in my VB.NET app I would change.  I'm not trying to do this C# walkthrough, and I can't see anything that in principle I can carry over to what I'm trying to do...but I do feel that these 2 problems are probably related.

Does anyone know how I can get over this latest hump with .NET and remoting?

Thanks.
0
Comment
Question by:bryker
12 Comments
 
LVL 23

Expert Comment

by:naveenkohli
ID: 7155827
Where is this class defined? Is it in some common assembly that is available to both client and server.

0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7156547
Try to see if you can get to the server using:
tcp://MOSCOW:8082/Test1

Once you have the server finished you will need to create a proxy. So go to another machine and type in:
soapsuds -url:tcp://MOSCOW:8082/Test1 -oa:Server.dll

(server.dll should be the name of your dll)

Now you get an xml proxy which you can use on your client.

How far are you already with remoting?

CJ
 

 
0
 

Author Comment

by:bryker
ID: 7157136
naveenkohli:

The "SomeLib" is indeed a .DLL referenced by both the client and server apps (in which the "SomeLib.MyNotifierClass" is found).
0
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 

Author Comment

by:bryker
ID: 7157182
CJ:

Two things happen (or don't happen) when I try to take Step 1 of your suggestion:

>Try to see if you can get to the server using:
>tcp://MOSCOW:8082/Test1

1.  My browser (IE6) changes the "tcp" prefix to "hcp" in this URL.
2.  The browser never navigates anywhere.

>How far are you already with remoting?

Not far at all.  As I said above, I'm just trying to get my feet wet and get something to work.  The only reason I'm trying this is because I want my server app to inform my client app (via an event) when a long process (in another thread) is complete.  I'm told that I'll want to do this via remoting, though I'm not even sure yet how one calls methods/events of these remote objects like SomeLib.MyNotifierClass from server-side so that client-side events fire.  But I'm hopeful.
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7157237
It is pretty hard to explain step by step. I only read about it so far.

Here's a link with some, probable, useful sourcecode:

http://www.dotnetremoting.cc/zips/advanceddotnetremoting_vb.zip

Could you show your servercode? The simplest as can be?

CJ
0
 

Author Comment

by:bryker
ID: 7157612
Thanks for all the source code examples.  I opened the Chapter 2 demo, but can't run it.

In the Client.vb module, this line

>Dim cust As Customer = mgr.getCustomer(4711)

fails with:

>An unhandled exception of type 'System.Net.WebException' occurred in mscorlib.dll
>Additional information: The underlying connection was closed: Unable to connect to the remote server.

I'm starting to think that either (1) somehow, my IIS installation prohibits any remoting, or (2) this remoting stuff is very, very flaky.
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7157644
I'm working on the sample right now. I already got the WebService part working. Resolving an error at the client now.

CJ
0
 

Author Comment

by:bryker
ID: 7157735
CJ:

>Could you show your servercode? The simplest as can be?

Here's the whole project, basically, starting with the server-side code.  There is presumably not much to it.

Thanks.

'///////////////////////////////////////////////
'//   MyWebService.asmx.vb
'//
'//   [references CommonLib.DLL]
'///////////////////////////////////////////////
Imports Remoting = System.Runtime.Remoting
<WebMethod()> _
Public Function GetServerPortID( _
   ) _
   As Integer

   Dim oTCPChannel As New Remoting.Channels.Tcp.TcpChannel(8081)

   Call Remoting.Channels.ChannelServices.RegisterChannel(oTCPChannel)

   '** This seems to work.  Throws no exceptions.
   Call Remoting.RemotingConfiguration.RegisterWellKnownServiceType( _
      GetType(CommonLib.CommonNotifier), _
      "Test1", _
      Remoting.WellKnownObjectMode.SingleCall _
      )

   '** This value is SUCCESSFULLY returned to the WinClient.
   Return 8081

End Function

'///////////////////////////////////////////////
'//   CommonLib.DLL
'///////////////////////////////////////////////
Public Class CommonNotifier

   Inherits MarshalByRefObject

   Public Event TaskComplete(ByVal nResultCode As Integer)

   Public Sub New()
     ...
   End Sub

End Class

'///////////////////////////////////////////////
'//   WinClient.EXE
'//
'//   [references CommonLib.DLL]
'///////////////////////////////////////////////
Imports Channels = System.Runtime.Remoting.Channels

Private objWebService As moscow.MyWebService
Private objNotifier As CommonLib.CommonNotifier

Private Sub btnTestRemoting_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
   Handles btnCalibrateBaseCase.Click

   If (objNotifier Is Nothing) Then
      objNotifier = New CommonLib.CommonNotifier()
   End If

   Dim nPortID As Integer = 0
   nPortID = objWebService.GetServerPortID()

   '** nPortID contains 8081 now
   If (nPortID > 0) Then

      Dim oTCPChannel As New Channels.Tcp.TcpChannel(8082)
      Call Channels.ChannelServices.RegisterChannel(oTCPChannel)

     '****************************************************
      '** The call to GetObject below fails with the error:
     '****************************************************
     '**    An unhandled exception of type
      '** 'System.IO.FileNotFoundException' occurred in
      '** mscorlib.dll
      '**    Additional information: File or assembly name
      '** WinClient, or one of its dependencies, was not
      '** found.
      objNotifier = _
         Activator.GetObject( _
            GetType(CommonLib.CommonNotifier), _
            "tcp://MOSCOW:" & CStr(nPortID) & "/Test1" _
            )
   End If

End Sub
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7157841
Still haven't solved it. Thank you for the code I will look at it and try to find out what is wrong.

Quiting for the day.

CJ

(ps. just got across this article: http://hosting.msugs.ch/dotnetrox/vb/Ch08.html)
0
 

Author Comment

by:bryker
ID: 7165850
I'm moving on from this problem.  I had to use other means.
0
 

Accepted Solution

by:
ComTech earned 0 total points
ID: 7165930
This question will be placed in PAQ, and points refunded.

Regards,

ComTech
Community Support Administrator  
Experts-Exchange  
0
 

Expert Comment

by:tmholt
ID: 7262542
One think I noticed is that you are registering the service on Channel 8081 and then attempting to look it up on 8082. Why is this?

I have having an issue with the same error, but later in the process when attempting to attach a delegate to the created service class. The creation of the service class seems to work correctly.

My only other question would be if the installutil call worked properly and the service started before running the client program.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Screencast - Getting to Know the Pipeline

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question