Solved

Puzzling Remoting Exception

Posted on 2002-07-15
12
388 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

773 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