Solved

Puzzling Remoting Exception

Posted on 2002-07-15
12
386 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
 

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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now