By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,152 Members | 2,159 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,152 IT Pros & Developers. It's quick & easy.

namespace System.Runtime.Remoting.Channels.Tcp is not recongized?

P: n/a
When I try to compile the following program on Visual Studio 2005 Pro,
the namespace System.Runtime.Remoting.Channels.Tcp is not recongized by
the compiler. (The "Tcp" part is highlighted.) And I get the error
message:

Error 1 The type or namespace name 'Tcp' does not exist in the
namespace 'System.Runtime.Remoting.Channels' (are you missing an
assembly reference?) C:\Documents and Settings\james\My
Documents\Visual Studio
2005\Projects\Try\RemoteObject\helloservicest.cs 7 40 RemoteObject

I am new to .NET. Can some one please help? Thanks a lot!

// file: helloservicest.cs
// compile: csc helloservicest.cs
// Exposes HelloObj in Singleton mode over TCP
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;

// the remote HelloObj object...
public class HelloObj : MarshalByRefObject
{
public HelloObj()
{
Console.WriteLine("HelloObj activated...");
}
public string Greet(string name)
{
// lock out other clients while incrementing numGreet...
lock (this) { numGreet++; }
// greet...
string greeting = "Hello, " + name + "!";
Console.WriteLine("greeting #{0}: " + greeting, numGreet);
return greeting;
}
private int numGreet = 0;
}
// the hosting service, HelloService...
public class HelloService
{
public static void Main(string[] args)
{
// register a channel...
ChannelServices.RegisterChannel(new TcpChannel(6789));
// register HelloObj with remoting services...
Console.WriteLine("registering HelloObj as Singleton...");
RemotingConfiguration.RegisterWellKnownServiceType (
Type.GetType("HelloObj"), // remote object type
"HelloObj", // remote object name
WellKnownObjectMode.Singleton); // activation mode
Console.WriteLine("waiting for remote calls...");
Console.WriteLine("hit ENTER to exit...");
Console.ReadLine();
}
}

Mar 28 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
ja********@gmail.com wrote:
When I try to compile the following program on Visual Studio 2005 Pro,
the namespace System.Runtime.Remoting.Channels.Tcp is not recongized by
the compiler. (The "Tcp" part is highlighted.) And I get the error
message:

Error 1 The type or namespace name 'Tcp' does not exist in the
namespace 'System.Runtime.Remoting.Channels' (are you missing an
assembly reference?) C:\Documents and Settings\james\My
Documents\Visual Studio
2005\Projects\Try\RemoteObject\helloservicest.cs 7 40 RemoteObject

I am new to .NET. Can some one please help? Thanks a lot!

// file: helloservicest.cs
// compile: csc helloservicest.cs
// Exposes HelloObj in Singleton mode over TCP
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;


Hi James

Had exactly the same problem myself recently. You need to add a
reference in your project to System.Runtime.Remoting and it should
recognise the channels then.

Hope that helps.

Dave
Mar 29 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.