Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have built the application as follows. But i'am getting an error as "The remote server returned an error: (404) Not Found". Can anyone tell how to correct that error. Please help me out.

Build a Simple Remote Object

Hello.cs(Class library)

C#
using System;
using System.Runtime.Remoting;

namespace HelloWorldObject
{
    public class Hello : MarshalByRefObject
    {

        public string HelloWorld(string str)
        {
            return "Hello World received " + str + " from the client";
        }
    }
}

Add references to the following:
1) System.Runtime.Remoting


Host the Remote Object in Microsoft Internet Information Services

1) Create a new directory called HelloWorldWeb (preferably under \Inetpub\wwwroot\).
2) Create a directory named bin beneath the HelloWorldWeb directory.
3) Copy the HelloWorldObject.dll file from the HelloWorldObject\bin\debug\ directory to the HelloWorldWeb\bin\ directory.
4) Use Notepad.exe to create a new file called Web.config. Copy the following text, and then save it in the HelloWorldWeb directory: web.config

HTML
<configuration>
  <system.runtime.remoting>
    <application>

      <service>
        <wellknown mode="SingleCall">
                   type="HelloWorldObject.Hello, HelloWorldObject" 
                   objectUri="SimpleHelloWorld.soap" />
      </wellknown></service>

    </application>
  </system.runtime.remoting>
 </configuration>


5) Click Start, point to Programs, and then click Administrative Tools. Open Internet Services Manager.
6) Create a virtual directory in IIS.
7) Make the virtual directory alias SimpleHello, and then set the source directory to the HelloWorldWeb directory.


Build a Simple Console Application to Test the Remote Object

TestClient.cs(Console application)

C#
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Services;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Http;

using HelloWorldObject;

namespace Client
{
	class TestClient
	{

		[STAThread]
		static void Main(string[] args)
		{
			HttpChannel http = new HttpChannel();
			ChannelServices.RegisterChannel(http);

			Hello obj = (Hello)Activator.GetObject(typeof(Hello),"http://localhost/SimpleHello/SimpleHelloWorld.soap");
			Console.WriteLine(obj.HelloWorld("CLIENT APPLICATION"));
		}
	}
}

Add references to the following:
1) System.Runtime.Remoting
2) HelloWorldObject.dll (by browsing to the location of the .dll file)
Posted
Updated 13-Feb-12 19:40pm
v6
Comments
Member 8570559 13-Feb-12 22:40pm    
Any1 have answer for this...plz help me out....

1 solution

could you please see this articles and documents
NET Remoting under IIS - ASP.NET Application as Client
 
Share this answer
 
Comments
Member 8570559 14-Feb-12 2:26am    
whether do you have any link for the code that is written in C#
Michael dg 14-Feb-12 3:28am    
you can use this online code converter from telerik http://converter.telerik.com/
Michael dg 14-Feb-12 3:33am    
It says that you should create a contract(interface). On that example it was the IServer inferface. And that interface are shared between client app and server app.
Member 8570559 14-Feb-12 5:27am    
michael can u answer with respect to above code....
Michael dg 14-Feb-12 10:06am    
I will try to recreate the code by tomorrow. I work on .NET Remoting before, base on that experience, .NET Remoting is stable if it comes create the object on the server side.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900