The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

import-bot (20211) [Avatar] Offline
[Originally posted by jconwell]

I tried to put the first remoting example from chapter 5 into practice, but
i'm having a problem. I can compile and run the server with no problem(I'm
using VS.NET instead of command line compiling). but when i try to compile
the client, i get a error the the HelloObj type could not be found. I
understand this, its because a reference to the remote object hasnt been made.
So i tried to make a reference to the remote object, but i get an error that
i cant make a reference to a file with an extension of .exe.

I noticed that in the book you used the command line compiler and set a /r
flag pointing to the exe with the remote object, so i tried this and get the
same type not found error.

what am i doing wrong?
import-bot (20211) [Avatar] Offline
Re: Chapter 5 Remoting Question
[Originally posted by fgrimes]


I just tried this using VS.NET and got the same error. To be honest, I
haven't got a clue why it complains. When you select Add Reference and then
click Browse, it lists files of type dll, tlb, olb, ocx, and exe. However, as
you point out, if you select an exe file, it complains with the message "Only
assemblies with extension 'dll' and COM components can be referenced."

As a workaround, if you wish to use VS.NET for this example, you could move
HelloObj into a separate dll file and compile both client and service with a
reference to this new dll. In fact, that would be a better way to structure
the application. (I considered this when writing the chapter, but eventually
decided that brevity was more important.)

On the other hand, command line compilation, depicted in figures 5.2 and 5.3,
should work. Try the following...

Make sure both client and service are in same directory, as they are in the
figures. If you have built either using VS.NET, make sure they are in the
same namespace. (By default, VS.NET creates a new namespace for a project.)
If this doesn't fix it, capture the error message from the compiler and post
it here so we can see what's going on.

import-bot (20211) [Avatar] Offline
Re: Chapter 5 Remoting Question
[Originally posted by bogatiy2]

I added these lines to the file helloclient.cs and it compiles fine from VS:

public interface HelloObj
string Greet(string name);

These are added outside the class definition.

Yes, VS doesn't want to let you read interface or class definitions from
executable files, only from dlls and other libraries. It's a filter, not a
fast rule. Try changing the file extension from .exe to .dll, and see if it
kittu_india143 (1) [Avatar] Offline
Re: Chapter 5 Remoting Question