cant add ref to remote object 
Author Message
 cant add ref to remote object

I'm screwing around with a simple remoting example and am
having a problem.  

I'm got the remote object and the server exe that
registers it compiled into one exe.  Then i've got another
exe that acts as the client that uses the remote object.  
but in my client code where i try to create an instance of
the obj, it tells me that i doesnt know what my remote
object is.  So when i tried to add a reference to the
remote obj, VS.NET tells me that i cant add a reference to
a file that ends in .exe.  

How do i create a reference to a remote object that is
compiled as an EXE?



Sat, 09 Apr 2005 01:29:40 GMT  
 cant add ref to remote object
John,

Have you looked at the remoting quick start guide at
http://samples.gotdotnet.com/quickstart/howto/doc/remoting/mainfeatur...
?
It provides a good overview with a simple example of how to get remoting set
up?

If that doesn't work, could you post some sample code from your project?

Kevin,

--

-----------------------
This posting is provided "AS IS" with no warranties, and confers no rights

Quote:
> I'm screwing around with a simple remoting example and am
> having a problem.

> I'm got the remote object and the server exe that
> registers it compiled into one exe.  Then i've got another
> exe that acts as the client that uses the remote object.
> but in my client code where i try to create an instance of
> the obj, it tells me that i doesnt know what my remote
> object is.  So when i tried to add a reference to the
> remote obj, VS.NET tells me that i cant add a reference to
> a file that ends in .exe.

> How do i create a reference to a remote object that is
> compiled as an EXE?



Sun, 10 Apr 2005 05:20:38 GMT  
 cant add ref to remote object

I'm having the same problem.  I'm trying to use an object that I host
in another application and when I try to compile it I get

E:\Projects\Testbed\Form1.cs(41): The type or namespace name 'SBServ'
could not be found (are you missing a using directive or an assembly
reference?)

when I try to 'add a reference' to my sbserv project by selecting the
sbserv.exe in the debug directory of that project it tells me that it
has to be a com object dll etc..

my server application

namespace SBServ
{
        using System.Diagnostics;

        public class Form1 : System.Windows.Forms.Form
        {
                private System.Windows.Forms.Button button1;
                private System.ComponentModel.Container components =
null;
                public Form1()
                {
                        InitializeComponent();
                        try
                        {
                                TcpChannel chan = new
TcpChannel(8085);
                                ChannelServices.RegisterChannel(chan);
                                Type thisType =
Type.GetType("SBServ.CAgent,SBServ");

RemotingConfiguration.RegisterWellKnownServiceType(thisType,
"SBServEndpoint", WellKnownObjectMode.SingleCall );
                        }
                        catch( Exception e )
                        {
                                Debug.WriteLine("boink" + e.ToString()
);
                        }

                }

-------------------------------------------------------------------------------------

namespace SBServ
{
        public class CAgent : MarshalByRefObject
        {
        ....
                public string Test( string strTest ) { strTest =
"tested" }
                ...
----------------------------------------------------------------------------------------

my client application

namespace Testbed
{
        public class Form1 : System.Windows.Forms.Form
        {
                private System.ComponentModel.Container components =
null;

                public Form1()
                {

                        InitializeComponent();

                        AppDomain app =
System.Threading.Thread.GetDomain();
                        Debug.WriteLine( "AppDomain: " +
app.FriendlyName );
                        TcpChannel chan = new TcpChannel();
                        ChannelServices.RegisterChannel(chan);
                        Type thisType = typeof(SBServ.CAgent);
                        SBServ.CAgent myService =
(SBServ.CAgent)Activator.GetObject(thisType,
"tcp://localhost:8085/SBServEndpoint");

compiling the testbed gives me the error.  I read that entire remoting
document and its still not clear to me how to resolve this problem.
:/

any help woudl be greatly apprecaited

On Tue, 22 Oct 2002 14:20:38 -0700, "Visual C# Team"

Quote:

>John,

>Have you looked at the remoting quick start guide at
>http://samples.gotdotnet.com/quickstart/howto/doc/remoting/mainfeatur...
>?
>It provides a good overview with a simple example of how to get remoting set
>up?

>If that doesn't work, could you post some sample code from your project?

>Kevin,



Mon, 11 Apr 2005 01:19:33 GMT  
 cant add ref to remote object
Have you tried making a reference to that COM object and then adding it to
the project?

For example, I referenced Microsoft Data 3.60  Object Library.

I then added it to the project:
using DAO;

Then created a DBEngine object:

DAO.DBEngine DBEngine = new DAO.DBEngineClass();

HTH


Quote:

> I'm having the same problem.  I'm trying to use an object that I host
> in another application and when I try to compile it I get

> E:\Projects\Testbed\Form1.cs(41): The type or namespace name 'SBServ'
> could not be found (are you missing a using directive or an assembly
> reference?)

> when I try to 'add a reference' to my sbserv project by selecting the
> sbserv.exe in the debug directory of that project it tells me that it
> has to be a com object dll etc..

> my server application

> namespace SBServ
> {
> using System.Diagnostics;

> public class Form1 : System.Windows.Forms.Form
> {
> private System.Windows.Forms.Button button1;
> private System.ComponentModel.Container components =
> null;
> public Form1()
> {
> InitializeComponent();
> try
> {
> TcpChannel chan = new
> TcpChannel(8085);
> ChannelServices.RegisterChannel(chan);
> Type thisType =
> Type.GetType("SBServ.CAgent,SBServ");

> RemotingConfiguration.RegisterWellKnownServiceType(thisType,
> "SBServEndpoint", WellKnownObjectMode.SingleCall );
> }
> catch( Exception e )
> {
> Debug.WriteLine("boink" + e.ToString()
> );
> }

> }

> --------------------------------------------------------------------------
-----------

> namespace SBServ
> {
> public class CAgent : MarshalByRefObject
> {
> ....
> public string Test( string strTest ) { strTest =
> "tested" }
> ...
> --------------------------------------------------------------------------
--------------

> my client application

> namespace Testbed
> {
> public class Form1 : System.Windows.Forms.Form
> {
> private System.ComponentModel.Container components =
> null;

> public Form1()
> {

> InitializeComponent();

> AppDomain app =
> System.Threading.Thread.GetDomain();
> Debug.WriteLine( "AppDomain: " +
> app.FriendlyName );
> TcpChannel chan = new TcpChannel();
> ChannelServices.RegisterChannel(chan);
> Type thisType = typeof(SBServ.CAgent);
> SBServ.CAgent myService =
> (SBServ.CAgent)Activator.GetObject(thisType,
> "tcp://localhost:8085/SBServEndpoint");

> compiling the testbed gives me the error.  I read that entire remoting
> document and its still not clear to me how to resolve this problem.
> :/

> any help woudl be greatly apprecaited

> On Tue, 22 Oct 2002 14:20:38 -0700, "Visual C# Team"

> >John,

> >Have you looked at the remoting quick start guide at

>http://samples.gotdotnet.com/quickstart/howto/doc/remoting/mainfeatur...
x
> >?
> >It provides a good overview with a simple example of how to get remoting
set
> >up?

> >If that doesn't work, could you post some sample code from your project?

> >Kevin,



Mon, 11 Apr 2005 09:18:05 GMT  
 cant add ref to remote object

its not a COM object (unless I'm missing something here).  Further,
how would I make it a COM object if thats what I need.  I have tried
in vain to add a ref to the exe without any luck at all.  Any help on
this would be greatly appreciated.

On Thu, 24 Oct 2002 01:18:05 GMT, "Richard T. Edwards"

Quote:

>Have you tried making a reference to that COM object and then adding it to
>the project?

>For example, I referenced Microsoft Data 3.60  Object Library.

>I then added it to the project:
>using DAO;

>Then created a DBEngine object:

>DAO.DBEngine DBEngine = new DAO.DBEngineClass();

>HTH



>> I'm having the same problem.  I'm trying to use an object that I host
>> in another application and when I try to compile it I get

>> E:\Projects\Testbed\Form1.cs(41): The type or namespace name 'SBServ'
>> could not be found (are you missing a using directive or an assembly
>> reference?)

>> when I try to 'add a reference' to my sbserv project by selecting the
>> sbserv.exe in the debug directory of that project it tells me that it
>> has to be a com object dll etc..

>> my server application

>> namespace SBServ
>> {
>> using System.Diagnostics;

>> public class Form1 : System.Windows.Forms.Form
>> {
>> private System.Windows.Forms.Button button1;
>> private System.ComponentModel.Container components =
>> null;
>> public Form1()
>> {
>> InitializeComponent();
>> try
>> {
>> TcpChannel chan = new
>> TcpChannel(8085);
>> ChannelServices.RegisterChannel(chan);
>> Type thisType =
>> Type.GetType("SBServ.CAgent,SBServ");

>> RemotingConfiguration.RegisterWellKnownServiceType(thisType,
>> "SBServEndpoint", WellKnownObjectMode.SingleCall );
>> }
>> catch( Exception e )
>> {
>> Debug.WriteLine("boink" + e.ToString()
>> );
>> }

>> }

>> --------------------------------------------------------------------------
>-----------

>> namespace SBServ
>> {
>> public class CAgent : MarshalByRefObject
>> {
>> ....
>> public string Test( string strTest ) { strTest =
>> "tested" }
>> ...
>> --------------------------------------------------------------------------
>--------------

>> my client application

>> namespace Testbed
>> {
>> public class Form1 : System.Windows.Forms.Form
>> {
>> private System.ComponentModel.Container components =
>> null;

>> public Form1()
>> {

>> InitializeComponent();

>> AppDomain app =
>> System.Threading.Thread.GetDomain();
>> Debug.WriteLine( "AppDomain: " +
>> app.FriendlyName );
>> TcpChannel chan = new TcpChannel();
>> ChannelServices.RegisterChannel(chan);
>> Type thisType = typeof(SBServ.CAgent);
>> SBServ.CAgent myService =
>> (SBServ.CAgent)Activator.GetObject(thisType,
>> "tcp://localhost:8085/SBServEndpoint");

>> compiling the testbed gives me the error.  I read that entire remoting
>> document and its still not clear to me how to resolve this problem.
>> :/

>> any help woudl be greatly apprecaited

>> On Tue, 22 Oct 2002 14:20:38 -0700, "Visual C# Team"

>> >John,

>> >Have you looked at the remoting quick start guide at

>>http://samples.gotdotnet.com/quickstart/howto/doc/remoting/mainfeatur...
>x
>> >?
>> >It provides a good overview with a simple example of how to get remoting
>set
>> >up?

>> >If that doesn't work, could you post some sample code from your project?

>> >Kevin,



Tue, 12 Apr 2005 11:32:14 GMT  
 cant add ref to remote object
Cross-posting to microsoft.public.dotnet.framework.remoting for more help.

Scott Wiltamuth

--

-----------------------
This posting is provided "AS IS" with no warranties, and confers no rights


Quote:
> You need to add a reference to the remoting object DLL that contains
> SBServ.CAgent type, not the EXE.

> --
> Grant & Subash

> -----------------------
> This posting is provided "AS IS" with no warranties, and confers no rights



> > I'm having the same problem.  I'm trying to use an object that I host
> > in another application and when I try to compile it I get

> > E:\Projects\Testbed\Form1.cs(41): The type or namespace name 'SBServ'
> > could not be found (are you missing a using directive or an assembly
> > reference?)

> > when I try to 'add a reference' to my sbserv project by selecting the
> > sbserv.exe in the debug directory of that project it tells me that it
> > has to be a com object dll etc..

> > my server application

> > namespace SBServ
> > {
> > using System.Diagnostics;

> > public class Form1 : System.Windows.Forms.Form
> > {
> > private System.Windows.Forms.Button button1;
> > private System.ComponentModel.Container components =
> > null;
> > public Form1()
> > {
> > InitializeComponent();
> > try
> > {
> > TcpChannel chan = new
> > TcpChannel(8085);
> > ChannelServices.RegisterChannel(chan);
> > Type thisType =
> > Type.GetType("SBServ.CAgent,SBServ");

> > RemotingConfiguration.RegisterWellKnownServiceType(thisType,
> > "SBServEndpoint", WellKnownObjectMode.SingleCall );
> > }
> > catch( Exception e )
> > {
> > Debug.WriteLine("boink" + e.ToString()
> > );
> > }

> > }

> --------------------------------------------------------------------------
> -----------

> > namespace SBServ
> > {
> > public class CAgent : MarshalByRefObject
> > {
> > ....
> > public string Test( string strTest ) { strTest =
> > "tested" }
> > ...

> --------------------------------------------------------------------------
> --------------

> > my client application

> > namespace Testbed
> > {
> > public class Form1 : System.Windows.Forms.Form
> > {
> > private System.ComponentModel.Container components =
> > null;

> > public Form1()
> > {

> > InitializeComponent();

> > AppDomain app =
> > System.Threading.Thread.GetDomain();
> > Debug.WriteLine( "AppDomain: " +
> > app.FriendlyName );
> > TcpChannel chan = new TcpChannel();
> > ChannelServices.RegisterChannel(chan);
> > Type thisType = typeof(SBServ.CAgent);
> > SBServ.CAgent myService =
> > (SBServ.CAgent)Activator.GetObject(thisType,
> > "tcp://localhost:8085/SBServEndpoint");

> > compiling the testbed gives me the error.  I read that entire remoting
> > document and its still not clear to me how to resolve this problem.
> > :/

> > any help woudl be greatly apprecaited

> > On Tue, 22 Oct 2002 14:20:38 -0700, "Visual C# Team"

> > >John,

> > >Have you looked at the remoting quick start guide at

>http://samples.gotdotnet.com/quickstart/howto/doc/remoting/mainfeatur...
> x
> > >?
> > >It provides a good overview with a simple example of how to get
remoting
> set
> > >up?

> > >If that doesn't work, could you post some sample code from your
project?

> > >Kevin,



Sat, 30 Apr 2005 06:34:02 GMT  
 cant add ref to remote object
Hi,
  Please try implementing CAgent in another project(dll assembly) different
from that of SBServ.Form1 and then let the server and client  both reference
the share project.
  Vs.net does not support reference one exe assembly now,if you really need
to use two projects instead of three projects, you can use the commandline
linker to do that.Please refer to Jeffrey Richter's Applied .net framework
programming.

Best regards,

Joy Hu



Quote:
> Cross-posting to microsoft.public.dotnet.framework.remoting for more help.

> Scott Wiltamuth

> --

> -----------------------
> This posting is provided "AS IS" with no warranties, and confers no rights


> > You need to add a reference to the remoting object DLL that contains
> > SBServ.CAgent type, not the EXE.

> > --
> > Grant & Subash

> > -----------------------
> > This posting is provided "AS IS" with no warranties, and confers no
rights



> > > I'm having the same problem.  I'm trying to use an object that I host
> > > in another application and when I try to compile it I get

> > > E:\Projects\Testbed\Form1.cs(41): The type or namespace name 'SBServ'
> > > could not be found (are you missing a using directive or an assembly
> > > reference?)

> > > when I try to 'add a reference' to my sbserv project by selecting the
> > > sbserv.exe in the debug directory of that project it tells me that it
> > > has to be a com object dll etc..

> > > my server application

> > > namespace SBServ
> > > {
> > > using System.Diagnostics;

> > > public class Form1 : System.Windows.Forms.Form
> > > {
> > > private System.Windows.Forms.Button button1;
> > > private System.ComponentModel.Container components =
> > > null;
> > > public Form1()
> > > {
> > > InitializeComponent();
> > > try
> > > {
> > > TcpChannel chan = new
> > > TcpChannel(8085);
> > > ChannelServices.RegisterChannel(chan);
> > > Type thisType =
> > > Type.GetType("SBServ.CAgent,SBServ");

> > > RemotingConfiguration.RegisterWellKnownServiceType(thisType,
> > > "SBServEndpoint", WellKnownObjectMode.SingleCall );
> > > }
> > > catch( Exception e )
> > > {
> > > Debug.WriteLine("boink" + e.ToString()
> > > );
> > > }

> > > }

> --------------------------------------------------------------------------
> > -----------

> > > namespace SBServ
> > > {
> > > public class CAgent : MarshalByRefObject
> > > {
> > > ....
> > > public string Test( string strTest ) { strTest =
> > > "tested" }
> > > ...

> --------------------------------------------------------------------------
> > --------------

> > > my client application

> > > namespace Testbed
> > > {
> > > public class Form1 : System.Windows.Forms.Form
> > > {
> > > private System.ComponentModel.Container components =
> > > null;

> > > public Form1()
> > > {

> > > InitializeComponent();

> > > AppDomain app =
> > > System.Threading.Thread.GetDomain();
> > > Debug.WriteLine( "AppDomain: " +
> > > app.FriendlyName );
> > > TcpChannel chan = new TcpChannel();
> > > ChannelServices.RegisterChannel(chan);
> > > Type thisType = typeof(SBServ.CAgent);
> > > SBServ.CAgent myService =
> > > (SBServ.CAgent)Activator.GetObject(thisType,
> > > "tcp://localhost:8085/SBServEndpoint");

> > > compiling the testbed gives me the error.  I read that entire remoting
> > > document and its still not clear to me how to resolve this problem.
> > > :/

> > > any help woudl be greatly apprecaited

> > > On Tue, 22 Oct 2002 14:20:38 -0700, "Visual C# Team"

> > > >John,

> > > >Have you looked at the remoting quick start guide at

>http://samples.gotdotnet.com/quickstart/howto/doc/remoting/mainfeatur...
> > x
> > > >?
> > > >It provides a good overview with a simple example of how to get
> remoting
> > set
> > > >up?

> > > >If that doesn't work, could you post some sample code from your
> project?

> > > >Kevin,



Sat, 30 Apr 2005 10:36:34 GMT  
 cant add ref to remote object

yea, I finally figured out that remoting was meant to have at least
the skeleton of the object has to be implemented in a dll.  It works
now with that method.  I guess I am just too used to the old
automation model from c++/mfc/atl.

thanks for the help



Quote:
>Hi,
>  Please try implementing CAgent in another project(dll assembly) different
>from that of SBServ.Form1 and then let the server and client  both reference
>the share project.
>  Vs.net does not support reference one exe assembly now,if you really need
>to use two projects instead of three projects, you can use the commandline
>linker to do that.Please refer to Jeffrey Richter's Applied .net framework
>programming.

>Best regards,

>Joy Hu



>> Cross-posting to microsoft.public.dotnet.framework.remoting for more help.

>> Scott Wiltamuth

>> --

>> -----------------------
>> This posting is provided "AS IS" with no warranties, and confers no rights


>> > You need to add a reference to the remoting object DLL that contains
>> > SBServ.CAgent type, not the EXE.

>> > --
>> > Grant & Subash

>> > -----------------------
>> > This posting is provided "AS IS" with no warranties, and confers no
>rights



>> > > I'm having the same problem.  I'm trying to use an object that I host
>> > > in another application and when I try to compile it I get

>> > > E:\Projects\Testbed\Form1.cs(41): The type or namespace name 'SBServ'
>> > > could not be found (are you missing a using directive or an assembly
>> > > reference?)

>> > > when I try to 'add a reference' to my sbserv project by selecting the
>> > > sbserv.exe in the debug directory of that project it tells me that it
>> > > has to be a com object dll etc..

>> > > my server application

>> > > namespace SBServ
>> > > {
>> > > using System.Diagnostics;

>> > > public class Form1 : System.Windows.Forms.Form
>> > > {
>> > > private System.Windows.Forms.Button button1;
>> > > private System.ComponentModel.Container components =
>> > > null;
>> > > public Form1()
>> > > {
>> > > InitializeComponent();
>> > > try
>> > > {
>> > > TcpChannel chan = new
>> > > TcpChannel(8085);
>> > > ChannelServices.RegisterChannel(chan);
>> > > Type thisType =
>> > > Type.GetType("SBServ.CAgent,SBServ");

>> > > RemotingConfiguration.RegisterWellKnownServiceType(thisType,
>> > > "SBServEndpoint", WellKnownObjectMode.SingleCall );
>> > > }
>> > > catch( Exception e )
>> > > {
>> > > Debug.WriteLine("boink" + e.ToString()
>> > > );
>> > > }

>> > > }

>> --------------------------------------------------------------------------
>> > -----------

>> > > namespace SBServ
>> > > {
>> > > public class CAgent : MarshalByRefObject
>> > > {
>> > > ....
>> > > public string Test( string strTest ) { strTest =
>> > > "tested" }
>> > > ...

>> --------------------------------------------------------------------------
>> > --------------

>> > > my client application

>> > > namespace Testbed
>> > > {
>> > > public class Form1 : System.Windows.Forms.Form
>> > > {
>> > > private System.ComponentModel.Container components =
>> > > null;

>> > > public Form1()
>> > > {

>> > > InitializeComponent();

>> > > AppDomain app =
>> > > System.Threading.Thread.GetDomain();
>> > > Debug.WriteLine( "AppDomain: " +
>> > > app.FriendlyName );
>> > > TcpChannel chan = new TcpChannel();
>> > > ChannelServices.RegisterChannel(chan);
>> > > Type thisType = typeof(SBServ.CAgent);
>> > > SBServ.CAgent myService =
>> > > (SBServ.CAgent)Activator.GetObject(thisType,
>> > > "tcp://localhost:8085/SBServEndpoint");

>> > > compiling the testbed gives me the error.  I read that entire remoting
>> > > document and its still not clear to me how to resolve this problem.
>> > > :/

>> > > any help woudl be greatly apprecaited

>> > > On Tue, 22 Oct 2002 14:20:38 -0700, "Visual C# Team"

>> > > >John,

>> > > >Have you looked at the remoting quick start guide at

>>http://samples.gotdotnet.com/quickstart/howto/doc/remoting/mainfeatur...
>> > x
>> > > >?
>> > > >It provides a good overview with a simple example of how to get
>> remoting
>> > set
>> > > >up?

>> > > >If that doesn't work, could you post some sample code from your
>> project?

>> > > >Kevin,



Sun, 01 May 2005 00:05:04 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. cant add > 255 objects to dialog

2. CArray of objects - cant "Add" new objects - cant convert from class CMyClass to class CMyClass

3. ref object and out object

4. New object Ref in Session Object

5. remote object Vs. local object

6. Cant use add-ins with VC6

7. Cant' add toolbar with ResourceView

8. Cant add items to CListView

9. WebService (Adding Ref from normal App.)

10. Arrays transmited by ref to COM objects

11. Passing a VARIANT by ref to a COM object

12. ExecutionEngineException occurs when passing ref object as 0/NULL from C++

 

 
Powered by phpBB® Forum Software