Puzzling Remoting Exception

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.
brykerAsked:
Who is Participating?
 
ComTechCommented:
This question will be placed in PAQ, and points refunded.

Regards,

ComTech
Community Support Administrator  
Experts-Exchange  
0
 
naveenkohliCommented:
Where is this class defined? Is it in some common assembly that is available to both client and server.

0
 
CJ_SCommented:
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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
brykerAuthor Commented:
naveenkohli:

The "SomeLib" is indeed a .DLL referenced by both the client and server apps (in which the "SomeLib.MyNotifierClass" is found).
0
 
brykerAuthor Commented:
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
 
CJ_SCommented:
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
 
brykerAuthor Commented:
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
 
CJ_SCommented:
I'm working on the sample right now. I already got the WebService part working. Resolving an error at the client now.

CJ
0
 
brykerAuthor Commented:
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
 
CJ_SCommented:
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
 
brykerAuthor Commented:
I'm moving on from this problem.  I had to use other means.
0
 
tmholtCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.