Remote Connection want work.

Duneworker 1 Reputation point
2021-01-31T18:17:41.53+00:00

I tried to make a remote connection in c# but faild.

Here is my code, can somebody help me?

string strAppDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);
string strConfDir = strAppDir + "\Remote_Server.exe.config";
RemotingConfiguration.Configure(strConfDir);

I also tried to this way:

TcpChannel channel = new TcpChannel(8080);
ChannelServices.RegisterChannel(channel);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(SampleObject), "HelloWorld",WellKnownObjectMode.SingleCall);

My Client looks like this:

TcpChannel chan = new TcpChannel();
ChannelServices.RegisterChannel(chan);

SampleObject obj = (SampleObject)Activator.GetObject(typeof(SampleObject),
"tcp://localhost:8080/Helloworld/SampleObject.soap");

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,996 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.